git init
git add .
git commit -m "init"
heroku create
heroku apps:rename NEWNAME
git push heroku master
heroku ps:scale web=1
heroku open
Created
June 4, 2014 11:18
-
-
Save KATT/758bec62175ae0b4e788 to your computer and use it in GitHub Desktop.
Heroku static web app. See https://github.com/KATT/boilerplate-heroku-static-nodejs-express-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
<!-- Place in `public/index.html` --> | |
Hello Heroku. |
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
{ | |
"dependencies": { | |
"express": "^4.4.1", | |
"passport-http": "^0.2.2", | |
"passport": "^0.2.0" | |
}, | |
"devDependencies": { | |
}, | |
"engines": { | |
"node": "0.10.x" | |
}, | |
"repository": { | |
"type": "git", | |
"url": "" | |
} | |
} |
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
web: node server.js |
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 = require('express') | |
, passport = require('passport') | |
, BasicStrategy = require('passport-http').BasicStrategy; | |
// Use the BasicStrategy within Passport. | |
// Strategies in Passport require a `verify` function, which accept | |
// credentials (in this case, a username and password), and invoke a callback | |
// with a user object. | |
passport.use(new BasicStrategy({}, | |
function(username, password, done) { | |
var success = (username === 'USERNAME' && password === 'PASSWORD'); | |
done(null, success); | |
} | |
)); | |
var app = express(); | |
app.use(passport.initialize()); | |
app.use(passport.authenticate('basic', { session: false })); | |
app.use(express.static(__dirname + '/public'));; | |
var port = Number(process.env.PORT || 5000); | |
app.listen(port, function() { | |
console.log("Listening on " + port); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment