chore(http): export NewBaseChiRouter constructor
parent
4790c3cb43
commit
2c85e1520f
|
@ -121,7 +121,7 @@ func WithResourceHandler(resHandler kithttp.ResourceHandler) APIHandlerOptFn {
|
||||||
// NewAPIHandler constructs all api handlers beneath it and returns an APIHandler
|
// NewAPIHandler constructs all api handlers beneath it and returns an APIHandler
|
||||||
func NewAPIHandler(b *APIBackend, opts ...APIHandlerOptFn) *APIHandler {
|
func NewAPIHandler(b *APIBackend, opts ...APIHandlerOptFn) *APIHandler {
|
||||||
h := &APIHandler{
|
h := &APIHandler{
|
||||||
Router: newBaseChiRouter(b.HTTPErrorHandler),
|
Router: NewBaseChiRouter(b.HTTPErrorHandler),
|
||||||
}
|
}
|
||||||
|
|
||||||
noAuthUserResourceMappingService := b.UserResourceMappingService
|
noAuthUserResourceMappingService := b.UserResourceMappingService
|
||||||
|
|
|
@ -28,7 +28,8 @@ func NewRouter(h platform.HTTPErrorHandler) *httprouter.Router {
|
||||||
return router
|
return router
|
||||||
}
|
}
|
||||||
|
|
||||||
func newBaseChiRouter(errorHandler platform.HTTPErrorHandler) chi.Router {
|
// NewBaseChiRouter returns a new chi router with a 404 handler, a 405 handler, and a panic handler.
|
||||||
|
func NewBaseChiRouter(errorHandler platform.HTTPErrorHandler) chi.Router {
|
||||||
router := chi.NewRouter()
|
router := chi.NewRouter()
|
||||||
bh := baseHandler{HTTPErrorHandler: errorHandler}
|
bh := baseHandler{HTTPErrorHandler: errorHandler}
|
||||||
router.NotFound(bh.notFound)
|
router.NotFound(bh.notFound)
|
||||||
|
|
Loading…
Reference in New Issue