Skip to content

Instantly share code, notes, and snippets.

@jonathanargentiero
Created January 25, 2017 14:38
Show Gist options
  • Select an option

  • Save jonathanargentiero/451f28e969b7bd310a6f6de5157bb1e9 to your computer and use it in GitHub Desktop.

Select an option

Save jonathanargentiero/451f28e969b7bd310a6f6de5157bb1e9 to your computer and use it in GitHub Desktop.
Quick Node.JS static server
var connect = require('connect');
var serveStatic = require('serve-static');
connect().use(serveStatic(__dirname)).listen(8080, function(){
console.log('Server running on 8080...');
});
/** package.json
{
"name": "myApp",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"connect": "^3.5.0",
"serve-static": "^1.11.1"
}
}
**/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment