I followed this great tutorial on setting up node.js on a2hosting: https://www.youtube.com/watch?v=BAD5JyOymRg
everything seems to work except for the CSS does not load in Firefox or Chrome and throws a 503 error for some reason. It also throws a 503 error if I point the href to no file at all. I have tried changing the href link to /stylesheets/style.css or moving style.css around but have not had any luck.
Any help would be greatly appreciated!
server.js:
var express = require('express');
var app = express();
var path = require('path');
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.use('/testapp/static', express.static('public'));
app.get('/testapp', (req, res) => {
res.render('index', { title: 'Express' });
});
app.listen();
package.json:
{
"name": "app",
"version": "1.0.0",
"description": "My App",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"express": "^6.14.7",
"ejs": "~2.6.1"
},
"author": "",
"license": "ISC"
}
index.ejs:
<!DOCTYPE html>
<html>
<head>
<link rel='stylesheet' href='http://*mysite*.com/testapp/static/stylesheets/style.css' />
</head>
<body>
<h1>Hello <%=title%></h1>
</body>
</html>
style.css:
body {
background-color: red;
}
Here's the folder structure:
testapp
-public
--stylesheets
---style.css
-views
--index.ejs
-server.js
-package.json
-node_modules
