For some reason if i specify port to listen in server.js, for example 4242
, but not process.env.PORT
, my .css files stop working (with process.env.PORT
it's working).
Code example:
Server.js:
var express = require('express');
var app = express()
, http = require('http')
, server = http.createServer(app)
app.get('/room', function (req, res) {
res.render('room.ejs')
});
server.listen(4242);
room.ejs:
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<meta charset="utf-8" />
<title></title>
</head>
///rest of HTML///
style.css
file itself is in public
folder that is in site's folder.