0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00
ghost/core/server/web/site/routes.js
Naz add30f3d5b Decoupled frontend routing from url service
refs https://linear.app/tryghost/issue/CORE-103/decouple-internal-frontend-code-from-url-module

- By becoming a parameter in the routing bootstrap process URL is Service no longer a "require" inside the frontend controllers but rather becomes a part of the "internal API" of the bootstrapper. This is not the end form of it, rather a step closer to decouplint routing from the URL serivce.
- The bootstrap module needs a facelift to have cleaner distinction between init/start methods. This is left for another time
2021-10-14 05:55:49 +13:00

12 lines
563 B
JavaScript

const debug = require('@tryghost/debug')('routing');
const routing = require('../../../frontend/services/routing');
// NOTE: temporary import from the frontend, will become a backend service soon
const urlService = require('../../../frontend/services/url');
const routeSettings = require('../../services/route-settings');
module.exports = function siteRoutes(options = {}) {
debug('site Routes', options);
options.routerSettings = routeSettings.loadRouteSettingsSync();
options.urlService = urlService;
return routing.bootstrap.init(options);
};