In this video we are going to learn about how can we serve the html pages to the client.
So lets see.
Go to the project and here first of all create a html file.
So just click on new file and lets say file name is home.html.
Now just open it and inside the home.html.
Write the html5 boilerplate and a text inside the body as following.


<!DOCTYPE html>
<html lang=\"en\">
<head>
<meta charset=\"UTF-8\">
<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">
<title>Home</title>
</head>
<body>
<h1>Home Page</h1>
</body>
</html>


Now goto the index.js file.
Here require the http and fs package and wirte the following code.


var http = require('http');
var fs = require('fs');

var server = http.createServer(function(req,res)
{
    res.writeHead(200,{'Content-Type':'text/html'});
    var readStream = fs.createReadStream(__dirname + '/index.html');
    readStream.pipe(res);
});
server.listen(3000);
console.log(\"server is running on localhost:3000\");



Now lets run this.
So go to the command prompt and run the command.

node index.js

Now its running on localhost:3000 port.
So switch to browser and here just type in url.
localhost:3000
You can see here the page.
So in this way you can serve the html pages.