I am trying to learn Node.js, I just installed express and am trying to build a HTML page, please see app1.js
var express=require('express');
var app=express();
var port=process.env.PORT||3000;
app.use(express.static('public'));
I read the page at
Express, and believe this should allow me to access my public folder and get the style.css page later in my code.
This next snippet of code is what I believe is causing me all my grief
app.get('/',function(req,res)
{
res.send("<html><head>"
+"<title> 9/3 </title>"
+"<link href='public/style.css' type='text/css' rel='stylesheet'/>"
+"</head><body><h1>Hello World!</h1><h2>"
+"Using Express to make my life easier</hr></body></html>");
});
The link for my css appears correct and when I look at the source code of the page it is correct. Yet no CSS is used.
All my CSS is trying to do is to set color:red:
+"<link href='public/style.css' type='text/css' rel='stylesheet'/>"
I attached both files, again the css is in my public folder which is in the folder my app1.js file is in.
Why will the CSS not work?
Where can I go to learn more about this?
Thanks