###Using Node.js as server with Express
Step 1: Install Express
$ npm install express
Step 2: Create a file named server.js with the following code:
var express = require('express');
var app = express();
app.use(express.static(__dirname)); //serve static files
app.get('/', function (req, res) {
res.send('Hello World!');
});
app.listen(3000, function () {
console.log('Server listening on port 3000!');
});
Step 3: Spinup server.js
$ node server.js
You can got to http://localhost:3000 or http://localhost:3000/yourfile.html