mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
- Makes the logic for determining the admin and frontend vhost args independent and easier to test - Moved the tests to specifically test the vhost utils & removed proxyquire as a dependency - We want to breakdown the current parent app into the existing core/app.js and boot code, allowing us to decouple the backend and frontend further - This is all part of the refactoring to separate server and frontend completely
25 lines
804 B
JavaScript
25 lines
804 B
JavaScript
const debug = require('@tryghost/debug')('web:frontend');
|
|
const express = require('../../../shared/express');
|
|
|
|
const shared = require('../shared');
|
|
|
|
/**
|
|
*
|
|
* @param {object} options
|
|
* @returns {import('express').RequestHandler}
|
|
*/
|
|
module.exports = (options) => {
|
|
debug('FrontendApp setup start');
|
|
|
|
// 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.use('/members', require('../members')());
|
|
frontendApp.use('/', require('../site')(options));
|
|
|
|
return frontendApp;
|
|
};
|