0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Cleaned up use of express in ghost-server

- There is now one true way to start Ghost - you create a server, and then call start with an express app
- We may well expand this again to improve testing pathways in future, but it will be done with a bit more clarity about expectations
This commit is contained in:
Hannah Wolfe 2021-02-23 10:35:25 +00:00
parent 3c7e2e3ac2
commit 3373b5bbd1
2 changed files with 5 additions and 7 deletions

View file

@ -251,8 +251,6 @@ async function bootGhost() {
ghostServer = new GhostServer(); ghostServer = new GhostServer();
await ghostServer.start(rootApp); await ghostServer.start(rootApp);
bootLogger.log('server started'); bootLogger.log('server started');
// @TODO: move this
ghostServer.rootApp = rootApp;
debug('End: load server + minimal app'); debug('End: load server + minimal app');
// Get the DB ready // Get the DB ready

View file

@ -35,15 +35,15 @@ class GhostServer {
* *
* ### Start * ### Start
* Starts the ghost server listening on the configured port. * Starts the ghost server listening on the configured port.
* Alternatively you can pass in your own express instance and let Ghost * Requires an express app to be passed in
* start listening for you. *
* @param {Object} externalApp - Optional express app instance. * @param {Object} rootApp - Required express app instance.
* @return {Promise} Resolves once Ghost has started * @return {Promise} Resolves once Ghost has started
*/ */
start(externalApp) { start(rootApp) {
debug('Starting...'); debug('Starting...');
const self = this; const self = this;
const rootApp = externalApp ? externalApp : self.rootApp; self.rootApp = rootApp;
let socketConfig; let socketConfig;
const socketValues = { const socketValues = {