Skip to content

Instantly share code, notes, and snippets.

@daxeh
Last active November 24, 2017 12:11
Show Gist options
  • Save daxeh/12a791fcd6ee8d4f3962de4fe6730c7c to your computer and use it in GitHub Desktop.
Save daxeh/12a791fcd6ee8d4f3962de4fe6730c7c to your computer and use it in GitHub Desktop.
Adhoc NodeJS static server
heroku login
heroku create your-app-name
## Existing .git
git push heroku master
## create instance
heroku ps:scale web=1
## your-app-name.herokuapp.com
heroku open
yarn add node-static
// index.js
var static = require('node-static');
var file = new static.Server();
require('http').createServer(function(request, response) {
request.addListener('end', function() {
file.serve(request, response);
}).resume();
}).listen(process.env.PORT || 3000);
// Git
git init
git add .
git commit -am "initial commit"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment