2013-09-06 19:54:50 +04:00
|
|
|
// # Ghost bootloader
|
|
|
|
// Orchestrates the loading of Ghost
|
2013-11-20 06:43:55 +04:00
|
|
|
// When run from command line.
|
2013-09-06 19:54:50 +04:00
|
|
|
|
2014-09-01 23:46:37 +04:00
|
|
|
var express,
|
|
|
|
ghost,
|
|
|
|
parentApp,
|
|
|
|
errors;
|
|
|
|
|
|
|
|
// Make sure dependencies are installed and file system permissions are correct.
|
|
|
|
require('./core/server/utils/startup-check').check();
|
|
|
|
|
|
|
|
// Proceed with startup
|
|
|
|
express = require('express');
|
|
|
|
ghost = require('./core');
|
|
|
|
errors = require('./core/server/errors');
|
|
|
|
|
|
|
|
// Create our parent express app instance.
|
|
|
|
parentApp = express();
|
2014-08-24 00:42:44 +04:00
|
|
|
|
2014-09-19 20:17:58 +04:00
|
|
|
ghost().then(function (ghostServer) {
|
2014-08-24 00:42:44 +04:00
|
|
|
// Mount our ghost instance on our desired subdirectory path if it exists.
|
2014-09-19 20:17:58 +04:00
|
|
|
parentApp.use(ghostServer.config.paths.subdir, ghostServer.rootApp);
|
2014-08-24 00:42:44 +04:00
|
|
|
|
|
|
|
// Let ghost handle starting our server instance.
|
2014-09-19 20:17:58 +04:00
|
|
|
ghostServer.start(parentApp);
|
2014-08-19 20:36:46 +04:00
|
|
|
}).catch(function (err) {
|
2014-02-20 07:22:02 +04:00
|
|
|
errors.logErrorAndExit(err, err.context, err.help);
|
2014-08-19 20:36:46 +04:00
|
|
|
});
|