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

@@ -9,10 +9,13 @@
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"body-parser": "^2.2.0",
"cookie-parser": "^1.4.7",
"cors": "^2.8.5",
"dotenv": "^17.2.0",
"ejs": "^3.1.10",
"express": "^5.1.0",
"jose": "^6.0.12",
"mysql2": "^3.14.2"
}
},
@@ -203,6 +206,25 @@
"node": ">= 0.6"
}
},
"node_modules/cookie-parser": {
"version": "1.4.7",
"resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.7.tgz",
"integrity": "sha512-nGUvgXnotP3BsjiLX2ypbQnWoGUPIIfHQNZkkC668ntrzGWEZVW70HDEB1qnNGMicPje6EttlIgzo51YSwNQGw==",
"license": "MIT",
"dependencies": {
"cookie": "0.7.2",
"cookie-signature": "1.0.6"
},
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/cookie-parser/node_modules/cookie-signature": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
"integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==",
"license": "MIT"
},
"node_modules/cookie-signature": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz",
@@ -650,6 +672,15 @@
"node": ">=10"
}
},
"node_modules/jose": {
"version": "6.0.12",
"resolved": "https://registry.npmjs.org/jose/-/jose-6.0.12.tgz",
"integrity": "sha512-T8xypXs8CpmiIi78k0E+Lk7T2zlK4zDyg+o1CZ4AkOHgDg98ogdP2BeZ61lTFKFyoEwJ9RgAgN+SdM3iPgNonQ==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/panva"
}
},
"node_modules/long": {
"version": "5.3.2",
"resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz",

View File

@@ -12,10 +12,13 @@
"license": "ISC",
"description": "",
"dependencies": {
"body-parser": "^2.2.0",
"cookie-parser": "^1.4.7",
"cors": "^2.8.5",
"dotenv": "^17.2.0",
"ejs": "^3.1.10",
"express": "^5.1.0",
"jose": "^6.0.12",
"mysql2": "^3.14.2"
}
}

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" });
}