added dependecies to later create the jwt token.

Those I have installed with npm, to be more specific with: npm install express cookie-parser body-parser jose
This commit is contained in:
2025-07-22 17:05:41 +02:00
parent c35838b034
commit c2a035ca34
3 changed files with 38 additions and 1 deletions

View File

@@ -10,6 +10,9 @@ import {
deleteUser,
getAllUsers,
} from "./database.js";
import cookieParser from "cookie-parser";
import bodyParser from "body-parser";
import jose from "jose";
//view engine ejs
app.set("view engine", "ejs");
@@ -24,7 +27,7 @@ app.post("/api/login", async (req, res) => {
loginUser(req.body.username, req.body.password)
.then((result) => {
if (result.success) {
res.status(200).json(result, { message: "Login successful" });
res.status(200).json(result, { message: "Login successful" }); // Here send the jwt token
} else {
res.status(401).json(result, { message: "Invalid credentials" });
}