Last active
July 25, 2017 05:35
-
-
Save muthuspark/a2be62f9c1ee63202bd708a9ccbb383f to your computer and use it in GitHub Desktop.
Using node.js as a simple web server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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