I am using Raspberry Pi 3 with Windows IoT 10.I want to open a html webpage in the web browser.Here raspberry pi as web server,it has to display html page. I have tried in node js,but i am unable to read the html file. Here is my code
var http = require('http');
var fs = require('fs');
var path = require('path');
var filepath;
filepath = path.join(__dirname,'/assets/index.html');
console.log(filepath);
http.createServer(function (req, res) {
// console.log(filepath);
fs.readFile(filepath, function (err, data) {
if (error) return console.error("Error in finding the file");
res.writeHead(200, { 'Content-Type': 'text/html', 'Content-Length': data.length });
res.write(data);
});
}).listen(1337);
I have create an index.html page under assets folder. Is this the correct way to host a web page or please please help me.