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.
try telling express wheres the static folder located in the server.js:
app.use(express.static(__dirname + '/public'));
and change:
<link rel="stylesheet" type="text/css" href="/style.css" /> //see the / on css route