I am having a problem serving my html file on my node server.
The code in "index.js" looks like this:
const express = require('express');
const app = express();
var path = require('path');
app.use(express.static(path.join(__dirname + '/public')));
app.get('/', function (req, res) {
res.sendFile('views/home.html');
});
app.listen(8081, function () {
console.log('Magic is happening on port 8081!');
});
Here is a picture of my file structure:
When i run the server, it gives me this error:
TypeError: path must be absolute or specify root to res.sendFile
In the end i need a server that can serve several different pages, this is only the first page i am serving (no sense in going further if the first page doesn't work..)
What am i doing wrong?

'/views/home.html'path.join(__dirname + '/public'), it should bepath.join(__dirname, 'public')