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
|
||||
func NewAPIHandler(b *APIBackend, opts ...APIHandlerOptFn) *APIHandler {
|
||||
h := &APIHandler{
|
||||
Router: newBaseChiRouter(b.HTTPErrorHandler),
|
||||
Router: NewBaseChiRouter(b.HTTPErrorHandler),
|
||||
}
|
||||
|
||||
noAuthUserResourceMappingService := b.UserResourceMappingService
|
||||
|
|
|
@ -28,7 +28,8 @@ func NewRouter(h platform.HTTPErrorHandler) *httprouter.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()
|
||||
bh := baseHandler{HTTPErrorHandler: errorHandler}
|
||||
router.NotFound(bh.notFound)
|
||||
|
|
Loading…
Reference in New Issue