Skip to content

Instantly share code, notes, and snippets.

@edorgeville
Created April 23, 2015 03:39
Show Gist options
  • Save edorgeville/afea5b70fbf74311cc71 to your computer and use it in GitHub Desktop.
Save edorgeville/afea5b70fbf74311cc71 to your computer and use it in GitHub Desktop.
Comment avoir un serveur rapido presto pour servir du contenu static avec Heroku
node_modules/
*.log

Static web server

  • Cloner ce repo
  • Placer le contenu à servir dans le dossier public/
  • Commit
  • Ajouter le remote heroku (https://git.heroku.com/mon-projet.git)
  • Git push heroku master
  • Sur heroku.com, ajouter votre sous-domaine pour votre application
  • Faire un CNAME vers mon-projet.herokuapp.org
var static = require('node-static');
var file = new static.Server('./public');
var port = process.env.PORT || 8080;
require('http').createServer(function (request, response) {
request.addListener('end', function () {
file.serve(request, response);
}).resume();
}).listen(port);
console.log('Listening on port ' + port);
{
"name": "Mon projet",
"version": "1.0.0",
"description": "Mon projet est vraiment un beau projet.",
"dependencies": {
"node-static": "^0.7.6"
}
}
web: node app.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment