// BasicRouter returns a chi router instance with basic user
// routes. Bool parameter determines whether registration is allowed or
// not (useful for applications where users are invited rather than
// allowed to register themselves).
BasicRouter returns a chi router instance with basic user
routes. Bool parameter determines whether registration is allowed or
not (useful for applications where users are invited rather than
allowed to register themselves).
// BasicRouter returns a chi router instance with basic user // routes . Bool parameter determines whether registration is allowed or // not ( useful for applications where users are invited rather than // allowed to register themselves ) .
func (h *Handler) BasicRouter(open bool) chi.Router {
	r := chi.NewRouter()
	r.Use(middleware.AllowContentType("application/json"))
	if open {
		r.Post("/", h.Register)
	}
	r.Route("/auth", func(sr chi.Router) {
		sr.Post("/", h.LogIn)
		sr.With(h.session.manager.Auth).Delete("/", h.LogOut)
	})
	r.NotFound(httpflow.NotFound(h.log))
	r.MethodNotAllowed(httpflow.MethodNotAllowed(h.log))
	return r
}
func ( h * Handler ) BasicRouter ( open bool ) chi . Router { r := chi . NewRouter ( ) r . Use ( middleware . AllowContentType ( " " ) ) if open { r . Post ( " " , h . Register ) } r . Route ( " " , func ( sr chi . Router ) { sr . Post ( " " , h . LogIn ) sr . With ( h . session . manager . Auth ) . Delete ( " " , h . LogOut ) } ) r . NotFound ( httpflow . NotFound ( h . log ) ) r . MethodNotAllowed ( httpflow . MethodNotAllowed ( h . log ) ) return r }
BasicRouter returns a chi router instance with basic user
routes.
BasicRouter returns a chi router instance with basic user routes .