summaryrefslogtreecommitdiff
path: root/main.go
AgeCommit message (Collapse)Author
2026-06-21Do not use init for HTTP handler registrationxengineering
This does not allow to use a *sql.DB which is initialized in main() inside to pass it to handlers with DB access.
2026-06-05Add global db variable and open connection to itHEADmainxengineering
This allows any handler to access the database via a global variable. The connection is closed when the run function finishes.
2026-05-24Add missing `.` to log messagesxengineering
2026-05-24Disable log timestampsxengineering
Many logging systems provide timestamps on their own. To avoid duplication it is disabled by default.
2026-05-23Split run() arguments into multiple linesxengineering
One line per argument makes the code more readable and also diffs in case arguments are changed.
2026-05-23Run go fmtxengineering
2026-05-23Make run fully configurablexengineering
This makes the run() function compared to main() useful at all since all parameters can be changed to test e.g. with unit tests.
2026-05-23Add handlers.goxengineering
This keeps the HTTP handlers in a separate file which registers the routes in an init() function. The main execution flow is still maintained in a now minimal main.go.
2026-05-23Rename srv to serverxengineering
This improves readability.
2026-05-23Register routes with init()xengineering
This makes the used *mux.Router from github.com/gorilla/mux a global variable. A new router is created in the line where the global variable is created. Handlers can be added across the code base in init() functions.
2026-05-23Add /versionxengineering
2026-05-23Log HTTP URLxengineering
2026-05-21Fix stop messagexengineering
2026-05-21Add HTTP-based hello worldxengineering
This demonstrates the HTTP server is working.
2026-05-21Log start and stop of serverxengineering
2026-05-21Introduce run() functionxengineering
This function should be called by main but can also be called by a unit test to run a server which might have different arguments which will likely be added.
2026-05-21Add Go hello world programxengineering
This is a starting point to build the server.