implement channel API (no use yet)

This commit is contained in:
2025-05-26 14:09:01 -04:00
parent 5782177c35
commit 9426ab2bae
4 changed files with 348 additions and 0 deletions

View File

@@ -70,6 +70,22 @@ func Start() {
r.Get("/", Whoami)
})
r.Route("/channels", func(r chi.Router) {
r.Use(SessionAuthMiddleware)
r.Get("/", ListChannels)
r.Route("/{channelID}", func(r chi.Router) {
r.Use(ChannelCtx) // Load channel
r.Get("/", GetChannel)
r.Delete("/", DeleteChannel)
r.Post("/edit", EditChannel)
})
r.Route("/new", func(r chi.Router) {
r.Use(LoginCtx)
r.Post("/", NewChannel)
})
})
r.Route("/messages", func(r chi.Router) {
r.Use(SessionAuthMiddleware) // Protect with authentication