21 lines
525 B
JavaScript
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"));
|
|
});
|