implement channel API (no use yet)
This commit is contained in:
16
api/api.go
16
api/api.go
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user