Files
login-page/backend/server.js
2025-06-20 20:52:03 +02:00

21 lines
525 B
JavaScript

// static variables
const express = require("express");
const app = express();
const port = 4000;
const path = require("path");
app.listen(port, () => {
console.log(`Server is running on http://localhost:${port}`);
});
// Middleware to parse JSON bodies
app.use(express.json());
// Middleware to serve static files from the 'public' directory
app.use(express.static("public"));
// Route to handle GET requests to the root URL
app.get("/", (req, res) => {
res.sendFile(path.join(__dirname, "/public/login.html"));
});