How santoshniroula/go-template works
This small Go web app serves two HTML pages: the root page and a todo list. The todo handler fetches JSON from JSONPlaceholder, builds page data, and renders the todo template; both handlers use the shared template-rendering function. The source shows these runtime relationships, but the README gives little further detail about product capabilities.
Main entry points: main.go Template renderer · index.html Index template · todo-list.html Todo list template
Components 9
Other components
- Browser
- HTTP server
cmd/web/main.go - Root handler
cmd/web/main.go - Todo handler
cmd/web/main.go - Todo fetch
cmd/web/main.go - Template renderer
cmd/web/main.go - Index template
templates/index.html - Todo list template
templates/todo-list.html - JSONPlaceholder todos
Connections 11
- Browser → HTTP server: sends request
- HTTP server → Root handler: dispatches /
- HTTP server → Todo handler: dispatches /todos/
- Root handler → Template renderer: renders page
- Todo handler → Todo fetch: fetches todos
- Todo fetch → JSONPlaceholder todos: requests JSON
- Todo fetch → Todo handler: returns todos
- Todo handler → Template renderer: renders data
- Template renderer → Index template: parses template
- Template renderer → Todo list template: parses template
- Template renderer → Browser: writes HTML