I have a small script that runs a server for static index.html file:
var http = require('http');
var fs =require('fs');
var server = http.createServer(function(req,res){
console.log('request was made : '+req.url);
res.writeHead(200,{'Content-Type':'text/html'});
var myReadStream = fs.createReadStream(__dirname +'/index.html','utf8');
myReadStream.pipe(res);
});
server.listen(3000,'127.0.0.1');
console.log('listening to 3000');
Is the a possibility to use a string instead of 'localhost:3000' say for example 'MyPAGE' to call the html file?
http://localhost:3000/MyPAGE? Or do you want to typeMyPAGEin browser address bar?nginxorapache.