mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 18:31:57 +03:00
7656d0bdda
refs #9192 - Moving towards a centralised concept of routing / routes - The base router now wraps express router, and offers us the features we need - Site Router is the parent router, it gets initialised with all of our default routing - App Router is a sub router for apps - apps register their routes/routers onto it. - TODO: refactor channels subrouter to work this same way - MAYBE: move the app router to the apps service
24 lines
846 B
JavaScript
24 lines
846 B
JavaScript
/**
|
|
* # Route Service
|
|
*
|
|
* Note: routes are patterns, not individual URLs, which have either
|
|
* subrouters, or controllers mounted on them. There are not that many routes.
|
|
*
|
|
* The route service is intended to:
|
|
* - handle the mounting of all the routes throughout the bootup sequence
|
|
* - keep track of the registered routes, and what they have mounted on them
|
|
* - provide a way for apps to register routes
|
|
* - keep routes being served in a sane order
|
|
*
|
|
* The route service does not handle:
|
|
* - redirects
|
|
* - assets
|
|
* These both happen prior to the routeService router being mounted
|
|
*/
|
|
|
|
// We expose this via the App Proxy, so that Apps can register routes
|
|
module.exports.appRouter = require('./app-router');
|
|
// This is the main router, that gets mounted in the express app in /site
|
|
module.exports.router = require('./site-router');
|
|
|