Reputation: 4286
I'm developing a node js project here is my project hierarchy.
Here is my .njs file
var http = require('http'),
fs = require('fs');
fs.readFile('./home.html', function (err, html) {
if (err) {
throw err;
}
http.createServer(function(request, response) {
response.writeHeader(200, {"Content-Type": "text/html"});
response.write(html);
response.end();
}).listen(8000);
});
But css files are not loaded.Please help me out with the correct coding.Thnx
Upvotes: 0
Views: 347
Reputation: 1917
I found the 'connect' module very simple to use:
var connect = require('connect');
connect.createServer(
connect.static(__dirname)
).listen(8000);
Upvotes: 1