summaryrefslogtreecommitdiffstats
path: root/cmd/web/routes.go (follow)
Commit message (Collapse)AuthorAgeFilesLines
* An Operations list page now renders data in tableMatthew Lemon2024-02-121-1/+1
| | | | | | | | | The data is fetched from the database and uses html/template to render the rows in a list. A critical bug was not including the dot in {{ template "main" . }} in the base template. THIS MEANT THAT NO DATA PASSED TO ExecuteTemplate function rendered and took a long time to figure out.
* Have added a listAll handler for new operation modelMatthew Lemon2024-02-111-0/+1
| | | | | | | This is the first attempt at querying a table with a foreign key relation and returning the result to be used in Go code. Learned quite a bit! Including getting a null pointer error because I forgot to initialise the sql.DB in the application structure.
* Adds the view handler for our organisation modelMatthew Lemon2024-02-101-0/+2
| | | | | | We omitted to include this earlier and it is needed for the create handler, which creates the new entity in the database and then redirects to the view handler which will show the organisation page.
* Created a /organisations/list routeMatthew Lemon2024-02-081-0/+4
| | | | | | There is also some basic CSS here. Also introduced a proper structured logger.
* Moved main to cmd/web and added routes() methodMatthew Lemon2024-02-081-0/+10
Started to separate out funtionality: added an application struct and several methods (routes(), home() and a notFound() error). At the moment, the application struct does not carry any other configuration objects or a database pool connection - it is just there to get the routing going.