mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-30 06:12:03 +03:00
b19424acb3
refs https://github.com/TryGhost/Toolbox/issues/152 - This stops the mounting of the admin and frontend from being buried deep in express initialisation - Instead it's explicit, which makes two things almost possible: 1. we can potentially boot the frontend or backend independently 2. we can pass services and settings loaded during boot into the frontend - This needs more work, but we can start to group all the frontend code together - Meanwhile we also need to rip apart the routing and url services to decouple the frontend from the backend fully - BABY STEPS! Co-authored-by: Hannah Wolfe <erisds@gmail.com>
22 lines
703 B
JavaScript
22 lines
703 B
JavaScript
const debug = require('@tryghost/debug')('web:backend');
|
|
const express = require('../../../shared/express');
|
|
|
|
/**
|
|
*
|
|
* @returns {import('express').RequestHandler}
|
|
*/
|
|
module.exports = () => {
|
|
debug('BackendApp setup start');
|
|
// BACKEND
|
|
// Wrap the admin and API apps into a single express app for use with vhost
|
|
const backendApp = express('backend');
|
|
|
|
backendApp.lazyUse('/ghost/api', require('../api'));
|
|
backendApp.lazyUse('/ghost/oauth', require('../oauth'));
|
|
backendApp.lazyUse('/ghost/.well-known', require('../well-known'));
|
|
|
|
backendApp.use('/ghost', require('../../services/auth/session').createSessionFromToken, require('../admin')());
|
|
|
|
return backendApp;
|
|
};
|