I have set up a local instance of nodejs and am currently running a web service that references a local index.html
file upon startup. This web service is operating on my desktop.
After experimenting with CSS, I've encountered an issue where the stylesheet does not load properly. Despite trying various methods, including embedding the styles within <style>
tags, the stylesheet does not get picked up by the system for some unknown reason.
The location of the stylesheet is as follows:
c:\program files\nodejs\default.css
The HTML code snippet is:
<link rel="stylesheet" type="text/css" href="default.css" />
This stylesheet resides in the same directory as index.js
and index.html
, and has the necessary permissions to be read.
Any insights into why the stylesheet may not be loading correctly would be greatly appreciated.
The content of index.js
is as follows:
var http = require('http');
var fs = require('fs');
http.createServer(function (req, res){
fs.readFile('index.html', function (err, data){
res.writeHead(200, {
'Content-Type': 'text/html',
'Content-Length' : data.length
});
res.write(data);
res.end();
});
}).listen(1337, '127.0.0.1');