mirror of
https://github.com/m1k1o/neko.git
synced 2025-08-01 07:49:53 +02:00
add API JWT auth.
This commit is contained in:
parent
31bd61e2d3
commit
71d39a5c74
5 changed files with 73 additions and 17 deletions
|
@ -29,17 +29,20 @@ func New(
|
|||
}
|
||||
}
|
||||
|
||||
func (h *RoomHandler) Router() *chi.Mux {
|
||||
func (h *RoomHandler) Router(
|
||||
usersOnly func(chi.Router, func(chi.Router)),
|
||||
adminsOnly func(chi.Router, func(chi.Router)),
|
||||
) *chi.Mux {
|
||||
r := chi.NewRouter()
|
||||
|
||||
r.Route("/screen", func(r chi.Router) {
|
||||
r.Get("/", h.ScreenConfiguration)
|
||||
r.Post("/", h.ScreenConfigurationChange)
|
||||
|
||||
r.Get("/configurations", h.ScreenConfigurationsList)
|
||||
|
||||
usersOnly(r, func(r chi.Router) {
|
||||
r.Get("/screen", h.ScreenConfiguration)
|
||||
})
|
||||
|
||||
// TODO
|
||||
adminsOnly(r, func(r chi.Router) {
|
||||
r.Post("/screen", h.ScreenConfigurationChange)
|
||||
r.Get("/screen/configurations", h.ScreenConfigurationsList)
|
||||
})
|
||||
|
||||
return r
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue