2
1
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2023-12-13 21:00:40 +01:00
Ghost/core/index.js
Hannah Wolfe baa8118893 Refactor common pattern in service files
- Use array destructuring
- Use @tryghost/errors
- Part of the big move towards decoupling, this gives visibility on what's being used where
- Biting off manageable chunks / fixing bits of code I'm refactoring for other reasons
2020-04-30 20:48:42 +01:00

26 lines
788 B
JavaScript

// ## Server Loader
// Passes options through the boot process to get a server instance back
const server = require('./server');
const errors = require('@tryghost/errors');
const GhostServer = require('./server/ghost-server');
// Set the default environment to be `development`
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
function makeGhost(options) {
options = options || {};
return server(options)
.catch((err) => {
if (!errors.utils.isIgnitionError(err)) {
err = new errors.GhostError({message: err.message, err: err});
}
return GhostServer.announceServerStopped(err)
.finally(() => {
throw err;
});
});
}
module.exports = makeGhost;