I want to create a function that return a http.Server and Serve the text of the file testText.txt in the body of the HTTP response when a GET request is made to the '/' route. Parse the request for a "paragraphs" parameter. That parameter must be an integer and represent the number of paragraph you want to receive starting from the beginning of the test text. Return the appropriate content in the body of the response. If any error happens, return a 500 error. If the provided route is not known, return a 404 error.
here is what i have so far
function makeServer() {
return http.createServer(function(req, res){
if(req.url === '/'){
fs.readFile('testText.txt', function(err , para){
console.log("Data", para);
res.end();
});
console.log("The end");
}
}