installed dependecies
This commit is contained in:
20
backend/server.js
Normal file
20
backend/server.js
Normal file
@@ -0,0 +1,20 @@
|
||||
// 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"));
|
||||
});
|
Reference in New Issue
Block a user