Ghost/index.js
Harry Wolff 8bc6a6e633 Makes the Ghost application more express middleware friendly.
refs #827

- Moves ./index to use Ghost in a similar manner to how someone uses
Ghost as an npm module.
- Allows Ghost to be cleanly mounted on another express application
on any arbitrary endpoint, all you need to customize is the mount path.
2014-08-29 17:30:16 -04:00

21 lines
617 B
JavaScript

// # Ghost bootloader
// Orchestrates the loading of Ghost
// When run from command line.
var express = require('express'),
ghost = require('./core'),
errors = require('./core/server/errors');
// 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);
}).catch(function (err) {
errors.logErrorAndExit(err, err.context, err.help);
});