mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-30 14:22:07 +03:00
4f9b72ff43
- This is a minor bugbare, but it will affect some configuration I'm about to do for c8 - I've been wanting to do it for ages, middleware is plural all on it's own so it's an odd affectation in our codebase - This also only exists in 2 places, everywhere else we use "middleware" - Sadly it did result in a lot of churn as I did a full find and replace, but consistency is king!
26 lines
824 B
JavaScript
26 lines
824 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.middleware.urlRedirects.frontendSSLRedirect);
|
|
|
|
frontendApp.lazyUse('/members', require('../members'));
|
|
frontendApp.use('/', require('../../../frontend/web')(options));
|
|
|
|
return frontendApp;
|
|
};
|