mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-05 09:50:34 +03:00
7e61f73b8c
- 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!
24 lines
806 B
JavaScript
24 lines
806 B
JavaScript
const debug = require('@tryghost/debug')('web:backend');
|
|
const express = require('../../../shared/express');
|
|
const vhostUtils = require('./vhost-utils');
|
|
|
|
/**
|
|
*
|
|
* @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.set('vhostArg', vhostUtils.getBackendHostArg());
|
|
|
|
backendApp.use('/ghost/api', require('../api')());
|
|
backendApp.use('/ghost/oauth', require('../oauth')());
|
|
backendApp.use('/ghost/.well-known', require('../well-known')());
|
|
backendApp.use('/ghost', require('../../services/auth/session').createSessionFromToken, require('../admin')());
|
|
|
|
return backendApp;
|
|
};
|