1. Simply paste below mentioned code in a file server.js
var connect = require('connect');
var serveStatic = require('serve-static');
connect().use(serveStatic(__dirname)).listen(8080, function(){
console.log('Server running on 8080...');
});
2. Run this server.js via command prompt
node server.js
3. This will start a HTTP server on port 8080 and pickup the content from current directory
This is quite useful when you want to see some static content using a server
No comments:
Post a Comment