Last active
August 29, 2015 14:10
-
-
Save DenisMir/5db55563bb3ceabbda47 to your computer and use it in GitHub Desktop.
Ghost Frontend HTTP Basic Auth
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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