mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -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 |
||
---|---|---|
.. | ||
adapters | ||
api | ||
apps | ||
config | ||
data | ||
helpers | ||
lib | ||
models | ||
public | ||
services | ||
translations | ||
views | ||
web | ||
analytics-events.js | ||
filters.js | ||
ghost-server.js | ||
index.js | ||
overrides.js | ||
update-check.js |