mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
691daa2a49
refs #9601 - if you call `express.Router()`, the router's name is always "router" - that is caused by the closure behaviour in express: - https://github.com/expressjs/express/blob/4.16.3/lib/router/index.js#L46 - Ghost creates a couple of express routers for dynamic routing - it depends how much you configure in your routes.yaml file - but every router is called "router" - this is hard to work with - with this router wrapping logic, we are able to give each router an exact name If you enable `DEBUG=ghost:services:routing:*`, you have seen this before > ghost:services:routing:ParentRouter site: mountRouter: router +0ms With the wrapper logic, you will see: > ghost:services:routing:ParentRouter site: mountRouter: StaticPagesRouter +0ms - furthermore, if you have to access the router stack (`app.router.stack`), you can easily identify and find router instances by name |
||
---|---|---|
.. | ||
controllers | ||
helpers | ||
middlewares | ||
bootstrap.js | ||
CollectionRouter.js | ||
index.js | ||
ParentRouter.js | ||
PreviewRouter.js | ||
registry.js | ||
RSSRouter.js | ||
StaticPagesRouter.js | ||
StaticRoutesRouter.js | ||
TaxonomyRouter.js |