summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-02-10 12:42:09 +0000
committerMatthew Lemon <y@yulqen.org>2024-02-10 12:42:09 +0000
commit030806353ca9b329bfb0102ebc10518b641511ee (patch)
tree013c4f13c8b6609196c9a315250b8e8bc0b7d746
parentaa9b88ae875bfa82500e4702583cc40010825e71 (diff)
Adds the view handler for our organisation model
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.
-rw-r--r--cmd/web/handlers.go4
-rw-r--r--cmd/web/routes.go2
2 files changed, 6 insertions, 0 deletions
diff --git a/cmd/web/handlers.go b/cmd/web/handlers.go
index bfe73dd..d4ac91c 100644
--- a/cmd/web/handlers.go
+++ b/cmd/web/handlers.go
@@ -58,6 +58,10 @@ func (app *application) home(w http.ResponseWriter, r *http.Request) {
}
}
+func (app *application) organisationView(w http.ResponseWriter, r *http.Request) {
+ w.Write([]byte("This is an organisation"))
+}
+
func (app *application) organisationCreate(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodPost {
w.Header().Set("Allow", http.MethodPost)
diff --git a/cmd/web/routes.go b/cmd/web/routes.go
index 7e3aabd..23ecf7b 100644
--- a/cmd/web/routes.go
+++ b/cmd/web/routes.go
@@ -10,5 +10,7 @@ func (app *application) routes() *http.ServeMux {
mux.HandleFunc("/", app.home)
mux.HandleFunc("/organisation/list", app.listOrganisation)
+ mux.HandleFunc("/organisation/view", app.organisationView)
+ mux.HandleFunc("/organisation/create", app.organisationCreate)
return mux
}