I am struggling to serve the login page from my public folder using Express. Despite my efforts to adjust the path, I have not been successful. I want to be able to include more code in the callback function, but the current setup does not allow for it. Even when I try to convert the callback into a full function, it still doesn't work.
My directory structure
- root
- server
- server.js
- public
- login
- index.html
const express = require('express');
const app = express();
const path = require('path');
app.listen(4000);
console.log('Server started\n');
// Serve login page
app.get('/', () => app.use(express.static(__dirname + '/public/login')));
// What I'm aiming for
app.get('/', () => {
// Serve file
});