Skip to content

Instantly share code, notes, and snippets.

@muthuspark
Last active July 25, 2017 05:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save muthuspark/a2be62f9c1ee63202bd708a9ccbb383f to your computer and use it in GitHub Desktop.
Save muthuspark/a2be62f9c1ee63202bd708a9ccbb383f to your computer and use it in GitHub Desktop.
Using node.js as a simple web server
Install connect and serve-static with NPM
$ npm install connect serve-static
Create server.js file with this content:
var connect = require('connect');
var serveStatic = require('serve-static');
connect().use(serveStatic(__dirname)).listen(8080, function(){
console.log('Server running on 8080...');
});
Run with Node.js
$ node server.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment