Having trouble applying an external CSS file to my HTML file.
Currently working on a Cloud IDE (goormIDE, similar to C9) and trying to link an external CSS file to my HTML file on the web server using Node.js. However, the CSS file is not being applied to the HTML. I've done extensive research but can't seem to find a solution.
The project consists of 3 main files: index.html, style.css, and main.js. They are all located in the same folder.
index.html
<!doctype html>
<html>
<head>
<title>YOONJONG</title>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css" type="text/css" >
</head>
<body>
<a href="intro.html">INTRO</a>
<a href="portfolio.html">PORTFOLIO</a>
<a href="board.html">BOARD</a>
<a href="contact.html">CONTACT</a>
<p>blahblah</p>
</body>
</html>
style.css
a {
font-size: 36px;
font-weight: 800;
}
p {
font-size: 20px;
}
main.js
var http = require('http');
var fs = require('fs');
var app = http.createServer(function(request,response){
var url = request.url;
if(request.url == '/'){
url = '/index.html';
}
if(request.url == '/favicon.ico'){
response.writeHead(404);
response.end();
return;
}
response.writeHead(200);
response.end(fs.readFileSync(__dirname + url));
});
app.listen(80);