feat: create-room handler, with middleware

This commit is contained in:
efim
2023-11-04 05:52:20 +00:00
parent 850b6c693b
commit f8eb11c53e
4 changed files with 108 additions and 48 deletions

View File

@@ -21,14 +21,16 @@ func RegisterRoutes(sessions sessions.SessionManagement, rooms rooms.RoomManager
registerLoginRoutes(&templateFs, sessions, rooms)
// main page template
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
var templFile = "templates/index.gohtml"
tmpl := template.Must(template.ParseFS(templateFs, templFile))
err := tmpl.Execute(w, nil)
if err != nil {
log.Printf("my error in executing template, huh\n %s", err)
}
})
http.Handle("/", authedPageMiddleware(
sessions,
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
var templFile = "templates/index.gohtml"
tmpl := template.Must(template.ParseFS(templateFs, templFile))
err := tmpl.Execute(w, nil)
if err != nil {
log.Printf("my error in executing template, huh\n %s", err)
}
})))
// static resources route
http.Handle("/static/",