2013-09-06 10:54:50 -05:00
|
|
|
// # Ghost bootloader
|
|
|
|
// Orchestrates the loading of Ghost
|
2013-11-19 21:43:55 -05:00
|
|
|
// When run from command line.
|
2013-09-06 10:54:50 -05:00
|
|
|
|
2014-08-23 15:42:44 -05:00
|
|
|
var express = require('express'),
|
|
|
|
ghost = require('./core'),
|
|
|
|
errors = require('./core/server/errors');
|
2013-08-06 14:27:56 -05:00
|
|
|
|
2014-08-23 15:42:44 -05:00
|
|
|
// Create our parent express app instance.
|
|
|
|
var server = express();
|
|
|
|
|
|
|
|
ghost().then(function (instance) {
|
|
|
|
// Mount our ghost instance on our desired subdirectory path if it exists.
|
|
|
|
server.use(instance.config.paths.subdir, instance.app);
|
|
|
|
|
|
|
|
// Let ghost handle starting our server instance.
|
|
|
|
instance.start(server);
|
2014-08-19 11:36:46 -05:00
|
|
|
}).catch(function (err) {
|
2014-02-19 22:22:02 -05:00
|
|
|
errors.logErrorAndExit(err, err.context, err.help);
|
2014-08-19 11:36:46 -05:00
|
|
|
});
|