2015-05-28 16:16:09 +01:00
|
|
|
// # Ghost Startup
|
|
|
|
// Orchestrates the startup of Ghost when run from command line.
|
2016-06-03 09:06:18 +01:00
|
|
|
|
2016-09-14 14:50:17 +00:00
|
|
|
var ghost = require('./core'),
|
|
|
|
express = require('express'),
|
|
|
|
errors = require('./core/server/errors'),
|
2016-09-12 13:53:04 +02:00
|
|
|
utils = require('./core/server/utils'),
|
2016-09-14 14:50:17 +00:00
|
|
|
parentApp = express();
|
2016-06-03 09:06:18 +01:00
|
|
|
|
2014-09-19 16:17:58 +00:00
|
|
|
ghost().then(function (ghostServer) {
|
2015-05-28 16:16:09 +01:00
|
|
|
// Mount our Ghost instance on our desired subdirectory path if it exists.
|
2016-09-12 13:53:04 +02:00
|
|
|
parentApp.use(utils.url.getSubdir(), ghostServer.rootApp);
|
2014-08-23 16:42:44 -04:00
|
|
|
|
2015-05-28 16:16:09 +01:00
|
|
|
// Let Ghost handle starting our server instance.
|
2014-09-19 16:17:58 +00:00
|
|
|
ghostServer.start(parentApp);
|
2014-08-19 12:36:46 -04:00
|
|
|
}).catch(function (err) {
|
2014-02-19 22:22:02 -05:00
|
|
|
errors.logErrorAndExit(err, err.context, err.help);
|
2014-08-19 12:36:46 -04:00
|
|
|
});
|