mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 09:52:06 +03:00
8bb7088ba0
refs #9742 - removed usage of single permalink setting - with dynamic routing this configuration does no longer makes sense - because you can configure your permalinks in the routes.yaml - furthermore you can have multiple collections with multiple permalinks - removed @blog.permalinks - do not export permalink setting - do not import permalink setting - permalink setting UI will be removed soon - get rid of {globals.permalink} completely - remove yaml in-built migration - do not expose settings.permalinks via the private API - do not allow to edit this setting - keep phyiscal value in case a blog needs to rollback from v2 to v1 - sorted out when the routers should be created - ensure routes.yaml file doesn't get validated before Ghost is fully ready to start
60 lines
1.5 KiB
JavaScript
60 lines
1.5 KiB
JavaScript
var debug = require('ghost-ignition').debug('app'),
|
|
express = require('express'),
|
|
|
|
// App requires
|
|
config = require('../config'),
|
|
|
|
// middleware
|
|
compress = require('compression'),
|
|
netjet = require('netjet'),
|
|
|
|
// local middleware
|
|
ghostLocals = require('./middleware/ghost-locals'),
|
|
logRequest = require('./middleware/log-request');
|
|
|
|
module.exports = function setupParentApp(options = {}) {
|
|
debug('ParentApp setup start');
|
|
var parentApp = express();
|
|
|
|
// ## Global settings
|
|
|
|
// Make sure 'req.secure' is valid for proxied requests
|
|
// (X-Forwarded-Proto header will be checked, if present)
|
|
parentApp.enable('trust proxy');
|
|
|
|
parentApp.use(logRequest);
|
|
|
|
// enabled gzip compression by default
|
|
if (config.get('compress') !== false) {
|
|
parentApp.use(compress());
|
|
}
|
|
|
|
// Preload link headers
|
|
if (config.get('preloadHeaders')) {
|
|
parentApp.use(netjet({
|
|
cache: {
|
|
max: config.get('preloadHeaders')
|
|
}
|
|
}));
|
|
}
|
|
|
|
// This sets global res.locals which are needed everywhere
|
|
parentApp.use(ghostLocals);
|
|
|
|
// Mount the apps on the parentApp
|
|
// API
|
|
// @TODO: finish refactoring the API app
|
|
// @TODO: decide what to do with these paths - config defaults? config overrides?
|
|
parentApp.use('/ghost/api/v0.1/', require('./api/app')());
|
|
|
|
// ADMIN
|
|
parentApp.use('/ghost', require('./admin')());
|
|
|
|
// BLOG
|
|
parentApp.use(require('./site')(options));
|
|
|
|
debug('ParentApp setup end');
|
|
|
|
return parentApp;
|
|
};
|