I've encountered an issue where specifying a port to listen in server.js, such as 4242
, without using process.env.PORT
causes my .css files to stop working (they work fine with process.env.PORT
).
Here's an example of the code:
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);
Contents of room.ejs:
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<meta charset="utf-8" />
<title></title>
</head>
///rest of HTML///
The style.css
file is located in the public
folder within the site's directory.