In this video we are going to learn about Serving the JSON Data to the client.
Go to the prject and here inside the index.js file.
First of all require the http package and wirte the following code.


var http = require('http');
var server = http.createServer(function(req,res)
{
    res.writeHead(200,{'Content-Type':'application/json'});
    var student = {
        name:\"Jenifer\",
        email:\"jenifer@gmail.com\",
        phone:\"1234567890\",
        age:25.
    };
    res.end(JSON.stringify(student));
});
server.listen(3000);
console.log(\"Server is running on localhost:3000\");


Now lets run this.
So goto the command prompt and here just run the index.js file.


node index.js


Now its running on localhost:3000 port.
So switch to the browser and go to the url localhost:3000.
Here you can see the json data.
So in this way you can serve the json data to the client.