change router's names to names with prefix Must, because they might panic
This commit is contained in:
@@ -32,7 +32,7 @@ func NewRouter(cfg *config.Config) *Router {
|
||||
|
||||
// RouteHandler sets up the routes and middleware for the router.
|
||||
// TODO: implement hot reload for static files enabled/disabled
|
||||
func (r *Router) RouteHandler() chi.Router {
|
||||
func (r *Router) MustRoute() chi.Router {
|
||||
r.r.Use(middleware.Logger)
|
||||
r.r.Use(middleware.Recoverer)
|
||||
r.r.Use(middleware.Timeout(r.cfg.Server.TimeoutSeconds))
|
||||
@@ -58,8 +58,8 @@ func (r *Router) RouteHandler() chi.Router {
|
||||
}
|
||||
|
||||
r.r.Route("/api", func(api chi.Router) {
|
||||
api.Route("/block", block.Route(r.cfg))
|
||||
api.Route("/auth", auth.Route(r.cfg))
|
||||
api.Route("/block", block.MustRoute(r.cfg))
|
||||
api.Route("/auth", auth.MustRoute(r.cfg))
|
||||
})
|
||||
|
||||
r.r.Get("/health", func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Reference in New Issue
Block a user