aboutsummaryrefslogtreecommitdiffstats
path: root/backend
diff options
context:
space:
mode:
authorLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-07-27 20:53:38 +0530
committerLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-07-27 20:53:38 +0530
commitef9fc3325f10a7e44d62b85d709efd24afc76051 (patch)
tree48a090f2f0d735f9a37eb37cb4c0d3bca13b40ab /backend
parentfd87e69fd6972fc3f6adea5fbfbd5e4944cf4a9e (diff)
downloadadmin-panel-ef9fc3325f10a7e44d62b85d709efd24afc76051.tar.gz
admin-panel-ef9fc3325f10a7e44d62b85d709efd24afc76051.tar.bz2
admin-panel-ef9fc3325f10a7e44d62b85d709efd24afc76051.zip
moved jwt to .env
Diffstat (limited to 'backend')
-rw-r--r--backend/index.js3
-rw-r--r--backend/package.json2
-rw-r--r--backend/yarn.lock23
3 files changed, 27 insertions, 1 deletions
diff --git a/backend/index.js b/backend/index.js
index c7ac324..7b548ad 100644
--- a/backend/index.js
+++ b/backend/index.js
@@ -1,4 +1,5 @@
const express = require('express');
+const rateLimit = require('express-rate-limit');
const bodyParser = require('body-parser');
const bcrypt = require('bcryptjs');
const jwt = require('jsonwebtoken');
@@ -33,7 +34,7 @@ admin.initializeApp({
const db = admin.firestore();
// Secret key for JWT
-const JWT_SECRET = 'your_jwt_secret_key'; // Replace with your actual JWT secret key
+const JWT_SECRET = process.env.JWT_SECRET_KEY;
// Register route
app.post('/register', async (req, res) => {
diff --git a/backend/package.json b/backend/package.json
index f83b67a..c5f64aa 100644
--- a/backend/package.json
+++ b/backend/package.json
@@ -9,6 +9,8 @@
"cors": "^2.8.5",
"dotenv": "^16.4.5",
"express": "^4.19.2",
+ "express-rate-limit": "^7.4.0",
+ "express-validator": "^7.1.0",
"firebase-admin": "^12.2.0",
"jsonwebtoken": "^9.0.2"
}
diff --git a/backend/yarn.lock b/backend/yarn.lock
index 09b40bf..dbdbeac 100644
--- a/backend/yarn.lock
+++ b/backend/yarn.lock
@@ -607,6 +607,19 @@ event-target-shim@^5.0.0:
resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789"
integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==
+express-rate-limit@^7.4.0:
+ version "7.4.0"
+ resolved "https://registry.yarnpkg.com/express-rate-limit/-/express-rate-limit-7.4.0.tgz#5db412b8de83fa07ddb40f610c585ac8c1dab988"
+ integrity sha512-v1204w3cXu5gCDmAvgvzI6qjzZzoMWKnyVDk3ACgfswTQLYiGen+r8w0VnXnGMmzEN/g8fwIQ4JrFFd4ZP6ssg==
+
+express-validator@^7.1.0:
+ version "7.1.0"
+ resolved "https://registry.yarnpkg.com/express-validator/-/express-validator-7.1.0.tgz#e6571f6a4520560e1f3fae2ceab6f56c8f26c27b"
+ integrity sha512-ePn6NXjHRZiZkwTiU1Rl2hy6aUqmi6Cb4/s8sfUsKH7j2yYl9azSpl8xEHcOj1grzzQ+UBEoLWtE1s6FDxW++g==
+ dependencies:
+ lodash "^4.17.21"
+ validator "~13.12.0"
+
express@^4.19.2:
version "4.19.2"
resolved "https://registry.yarnpkg.com/express/-/express-4.19.2.tgz#e25437827a3aa7f2a827bc8171bbbb664a356465"
@@ -1035,6 +1048,11 @@ lodash.once@^4.0.0:
resolved "https://registry.yarnpkg.com/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac"
integrity sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==
+lodash@^4.17.21:
+ version "4.17.21"
+ resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
+ integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
+
long@^5.0.0, long@^5.2.3:
version "5.2.3"
resolved "https://registry.yarnpkg.com/long/-/long-5.2.3.tgz#a3ba97f3877cf1d778eccbcb048525ebb77499e1"
@@ -1443,6 +1461,11 @@ uuid@^9.0.0, uuid@^9.0.1:
resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30"
integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==
+validator@~13.12.0:
+ version "13.12.0"
+ resolved "https://registry.yarnpkg.com/validator/-/validator-13.12.0.tgz#7d78e76ba85504da3fee4fd1922b385914d4b35f"
+ integrity sha512-c1Q0mCiPlgdTVVVIJIrBuxNicYE+t/7oKeI9MWLj3fh/uq2Pxh/3eeWbVZ4OcGW1TUf53At0njHw5SMdA3tmMg==
+
vary@^1, vary@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"