Hi there,
Im currently trying to understand express and have the following app which does not seem to serve my static files. I looked a lot at online tutorials but nothing seems to work so far. Could you please tell me where I'm wrong?
here is my app.js:
var express = require('express');
var path = require('path');
var app = express();
app.use(express.static(path.join(__dirname, 'public')));
app.use(express.static(path.join(__dirname, 'static')));
app.listen(13245);
my directory looks like that:
..
-public
--index.html
-static
--css
---styles.css
--javascript
---nav.js
app.js
and my index.html has the following header:
<head>
<title>...</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" href="css/styles.css" />
<link rel="shortcut icon" href="favicon.ico"/>
<script src="javascript/nav.js"></script>
</head>
as a result, the index.html fil is served. But I have a GET error for the css and js files.
What should I change?
Cheers