I've some css issues in my easyrtc application, Here is my physical file structure
project
- login
- css
- style.css
- js
- script.css
- login.html
- logout.html
- css
- node_modules
- static
- server.js
- package.json
- login
In the server.js I've defined,
app.get('/', function(req, res, next) {
res.redirect('/login');
});
and
app.get('/login', function(req, res, next) {
res.sendfile('login.html', {root: './login'});
});
In my login.html I've include following link
<link rel="stylesheet" href="css/login.css" media="screen" type="text/css" />
Also I've tried with
<link rel="stylesheet" href="./login/css/login.css" media="screen" type="text/css" />
But this css file is not loading to browser, I've inspect the element. But there was an empty css file in sources. How can I fix this? What is the root of localhost:8080 my webserver running in port 8080 Although I go through the this nodejs express solution but I'm afraid can use this kind of solution for my existing project. If yes how can I add express middle-ware to load css? Help in advance. May the FOSS be with you.
The usual server.js used with easyrtc (as supplied in the server_example directory) has a directory called static that serves as the root directory of the static files getting served. For example, if you put files called
xxx.html
andyyy.css
in the static folder, you could reference xxx asand inside xxx.html you could reference yyy.css in your link statements as
or
Needless to say, subdirectories work as expected.