Homework

Homework — a second route and Recoverer

Make it yours.

  1. Add an /about route. Write a Handlers.About method that returns a short HTML string describing what SignFlow does, and register it in router.go with r.Get("/about", h.About). Verify with curl localhost:8080/about.

  2. Prove the config default works. Run PORT=9000 go run ./cmd/signflow and confirm the startup log now says port=9000 and the server answers on localhost:9000. Then set APP_ENV=prod and check starting signflow logs env=prod — the flag that will later flip Secure cookies.

  3. Break it on purpose. Add panic("boom") to the top of Home, reload the page, and watch Recoverer turn it into a 500 without killing the server — the log keeps running and /healthz still says ok. 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.