Ghost/core/server/web/parent/frontend.js
Hannah Wolfe faea2da596
Moved server/web/site to frontend/web
- we're slowly trying to draw the lines between the backend and the frontend correctly
- these files deal only with serving the frontend so they should live there
- there are lots of mixed requires in these files, so having them in the right place makes that clear
2021-10-21 19:28:18 +01:00

26 lines
825 B
JavaScript

const debug = require('@tryghost/debug')('frontend');
const express = require('../../../shared/express');
const shared = require('../shared');
/**
*
* @param {object} options
* @returns {import('express').RequestHandler}
*/
module.exports = (options) => {
debug('FrontendApp setup start', options);
// FRONTEND
const frontendApp = express('frontend');
// Force SSL if blog url is set to https. The redirects handling must happen before asset and page routing,
// otherwise we serve assets/pages with http. This can cause mixed content warnings in the admin client.
frontendApp.use(shared.middlewares.urlRedirects.frontendSSLRedirect);
frontendApp.lazyUse('/members', require('../members'));
frontendApp.use('/', require('../../../frontend/web')(options));
return frontendApp;
};