Skip to content

Instantly share code, notes, and snippets.

@KATT
Created June 4, 2014 11:18
Show Gist options
  • Save KATT/758bec62175ae0b4e788 to your computer and use it in GitHub Desktop.
Save KATT/758bec62175ae0b4e788 to your computer and use it in GitHub Desktop.
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
<!-- Place in `public/index.html` -->
Hello Heroku.
{
"dependencies": {
"express": "^4.4.1",
"passport-http": "^0.2.2",
"passport": "^0.2.0"
},
"devDependencies": {
},
"engines": {
"node": "0.10.x"
},
"repository": {
"type": "git",
"url": ""
}
}
web: node server.js
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