0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00
ghost/core/server/web/parent/backend.js
Hannah Wolfe 77996d1ee4
Moved vhost arg logic out of the parent app
- 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
2021-06-28 19:38:42 +01:00

19 lines
695 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.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;
};