import express from 'express';
import bodyParser from 'body-parser';
import { fileURLToPath } from 'url';
import path, { dirname } from 'path';
// rest of the code remains same
const app = express();
const PORT = 3000;

app.use((req, res, next) => {
    if (req.url.match(/^\/backend/)) {
        res.status(404).send('404 Not Found');
        return;
    }
    next();
});

app.use('/node_modules', express.static(path.join(__dirname + '/../../node_modules/'), { maxAge: -1 }));
app.use('/src', express.static(path.join(__dirname + '/../../src/'), { maxAge: -1 }));
app.use(express.static(path.join(__dirname + '/../'), { maxAge: -1 }));

app.use(bodyParser.json());
app.use((req, res, next) => {
    console.log(req.url);
    next();
});


app.get('/test', (req, res) => {
    res.status(200).send('hallo!');
});

import pushManager from './pushManager.js';
app.use(pushManager);

app.listen(PORT, () => {
    console.log(`⚡️[server]: Server is running at http://localhost:${PORT}`);
});