Skip to content

Instantly share code, notes, and snippets.

@DenisMir
Last active August 29, 2015 14:10
Show Gist options
  • Save DenisMir/5db55563bb3ceabbda47 to your computer and use it in GitHub Desktop.
Save DenisMir/5db55563bb3ceabbda47 to your computer and use it in GitHub Desktop.
Ghost Frontend HTTP Basic Auth
var express,
ghost,
app,
basicAuth,
path;
// Proceed with startup
express = require('express');
ghost = require('ghost');
basicAuth = require('basic-auth-connect');
path = require('path');
// Create our express app instance.
app = express();
app.use(basicAuth('test', 'test'));
// Set the config file
ghost().config = path.join(__dirname, 'ghost-config.js');
// Start Ghost
ghost().then(function (ghostServer) {
// Mount our ghost instance on our desired subdirectory path if it exists.
app.use(ghostServer.config.paths.subdir, ghostServer.rootApp);
// Let ghost handle starting our server instance.
ghostServer.start(app);
}).catch(function (err) {
errors.logErrorAndExit(err, err.context, err.help);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment