Implemented a custom logger with ASCII text coloring for development environment.
For production environment the logger type would be JSON.
Dynamically adding the port number for the server in live-reload.js with Go's template.
SQLC generated query for creating the urls table.
Setting the caching headers for all the static content to 10 days.
New env package for access the all the environment variables. This is because the Go compiler doesn't support cycle dependencies, having all the environment variables inside the config package cause this problem because it include the pretty-logger package and pretty-logger package imports the config package which creates a cycle dependency.
Updated all the routes to log every important details such as: server errors, cache hit/miss, invalid inputs, database errors, etc.
Changes
JSON
.live-reload.js
with Go's template.urls
table.env
package for access the all the environment variables. This is because the Go compiler doesn't support cycle dependencies, having all the environment variables inside theconfig
package cause this problem because it include thepretty-logger
package andpretty-logger
package imports theconfig
package which creates a cycle dependency.Screen Shoot for the pretty logger: