Extract server wiring (repositories, handlers, routes) #160
Labels
No labels
Agent/Chrome-Android
Agent/Chrome-Desktop
Agent/Chrome-iOS
Agent/Firefox-Android
Agent/Firefox-Desktop
Agent/Firefox-iOS
Agent/Safari-Desktop
Agent/Safari-iOS
Code/Backend
Code/DB
Code/DevOps
Code/Frontend
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
overdrives/chambersbr#160
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
cmd/web/main.go should only load config, connect the DB, build the server and run it. Move repository construction, handler construction and mainMux.HandleFunc(...) calls into internal/server (e.g. server.New(deps) http.Handler).
Also fix these:
The section comments are swapped: /** handlers / sits above repositories and / repositories **/ above handlers.
*templates is dereferenced and copied by value into every handler. template.Template should not be copied (go vet will flag it). Pass the pointer instead and update the handler constructors.
/test and /error routes use fmt.Printf for errors. Use the logger.
The //TODO: use custom log function next to log.Fatalf can be resolved here.
Acceptance criteria: