Returns files with the tag on nodejs. How?

Hello!

Is nodejs code:

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

new http.Server(function(req, res){

 sendFile("index.html", res);

}).listen(3000);

function sendFile(file_src, res){

 var file = new fs.ReadStream('index.html');
file.pipe(res);

 file.on('error', function(err){
 Res. statusCode = 500;
 Res. end("Server Error");
console.log(err);
});

 Res. on('close', function(){
file.destroy();
});

}


Which gives this file:

<!DOCTYPE html>
<html lang="en">
the <head>
 <meta charset="UTF-8">
the <title>Text</title>
</head>
the <body>
the <h1>Text</h1>
<img src="logo.png"> 
</body>
</html>


But when entering the page via the browser no pictures!

How to make so that it was?

In advance I Express my deep gratitude to all who help!
March 19th 20 at 09:28
0 answer

Find more questions by tags Node.js