Homework — a second route and Recoverer
Make it yours.
-
Add an
/aboutroute. Write aHandlers.Aboutmethod that returns a short HTML string describing what SignFlow does, and register it inrouter.gowithr.Get("/about", h.About). Verify withcurl localhost:8080/about. -
Prove the config default works. Run
PORT=9000 go run ./cmd/signflowand confirm the startup log now saysport=9000and the server answers onlocalhost:9000. Then setAPP_ENV=prodand checkstarting signflowlogsenv=prod— the flag that will later flip Secure cookies. -
Break it on purpose. Add
panic("boom")to the top ofHome, reload the page, and watchRecovererturn it into a500without killing the server — the log keeps running and/healthzstill saysok. Remove the panic.
Where this is going. Your Home handler writes HTML as a raw string — fine for one line, miserable for a real page (no type-checking, easy to forget a closing tag, no reuse). Lesson 2 replaces that string with Templ: type-safe, compiled HTML templates, with a shared layout the home page slots into. Same page, but the compiler now has your back.