var http = require('http');
http.createServer(function (req, res) {
if (req.url == '/')
{
req.url += "a.html";
//facebookAPI(req,res);
}
}).listen(1337);
when I typed the address in the browser it was not calling that url. Any thought Thank you.
Here is how you could serve that file. This is untested!
var http = require('http');
var fs = require('fs');
http.createServer(function (req, res) {
if (req.url == '/')
{
fs.readFile('a.html', 'utf8', function(err, data) {
if(err) {
res.end('Error Loading File');
return;
}
res.end(data);
});
} else {
res.writeHead(404, {'Content-Type': 'text/plain'});
res.end('file not found');
}
}).listen(1337);
There are better ways to accomplish the same thing, but this should get you started.