[英]CSS is not loading in easyrtc application on node.js
I've some css issues in my easyrtc application, Here is my physical file structure 我的easyrtc应用程序中存在一些CSS问题,这是我的物理文件结构
project 项目
In the server.js I've defined, 在我定义的server.js中,
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 在我的login.html中,我包含以下链接
<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. 但是此CSS文件未加载到浏览器中,我已经检查了该元素。 But there was an empty css file in sources.
但是源中有一个空的CSS文件。 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.
localhost:8080的根目录是什么,我的Web服务器运行在端口8080中,尽管我通过了nodejs express解决方案,但恐怕会为现有项目使用这种解决方案。 If yes how can I add express middle-ware to load css?
如果是,如何添加快速中间件来加载CSS? Help in advance.
提前帮助。 May the FOSS be with you.
愿FOSS与您同在。
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. 与easyrtc一起使用的常规server.js(在server_example目录中提供)具有一个名为static的目录,该目录充当要提供的静态文件的根目录。 For example, if you put files called
xxx.html
and yyy.css
in the static folder, you could reference xxx as 例如,如果将名为
xxx.html
和yyy.css
的文件放在静态文件夹中,则可以将xxx引用为
http://yoursite.com/xxx.html
and inside xxx.html you could reference yyy.css in your link statements as 在xxx.html中,您可以在链接语句中引用yyy.css为
href="yyy.css"
HREF = “yyy.css”
or 要么
href="/yyy.css"
HREF = “/ yyy.css”
Needless to say, subdirectories work as expected. 不用说,子目录按预期工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.