Skip to content

Commit 90a2d72

Browse files
committed
update modules to new versions
1 parent 6c70cc4 commit 90a2d72

File tree

5 files changed

+30
-18
lines changed

5 files changed

+30
-18
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,18 @@ Fullstack:
4848
4949
> [Angular 13 + Node.js + Express + MongoDB example](https://www.bezkoder.com/mean-stack-crud-example-angular-13/)
5050
51+
> [Angular 14 + Node.js + Express + MongoDB example](https://www.bezkoder.com/mean-stack-crud-example-angular-14/)
52+
53+
> [Angular 15 + Node.js + Express + MongoDB example](https://www.bezkoder.com/angular-15-node-js-express-mongodb/)
54+
55+
> [Angular 16 + Node.js + Express + MongoDB example](https://www.bezkoder.com/angular-16-node-js-express-mongodb/)
56+
5157
> [React + Node.js + Express + MongoDB example](https://www.bezkoder.com/react-node-express-mongodb-mern-stack/)
5258
5359
Integration on same Server/Port:
54-
> [Integrate Angular 8 with Node.js Express](https://www.bezkoder.com/integrate-angular-8-node-js/)
55-
56-
> [Integrate Angular 10 with Node.js Express](https://www.bezkoder.com/integrate-angular-10-node-js/)
60+
> [Integrate Vue with Node.js Express](https://www.bezkoder.com/serve-vue-app-express/)
5761
58-
> [Integrate Angular 12 with Node.js Express](https://www.bezkoder.com/integrate-angular-12-node-js/)
62+
> [Integrate Angular with Node.js Express](https://www.bezkoder.com/integrate-angular-12-node-js/)
5963
6064
> [Integrate React with Node.js Express](https://www.bezkoder.com/integrate-react-express-same-server-port/)
6165

app/config/db.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
HOST: "localhost",
2+
HOST: "0.0.0.0",
33
PORT: 27017,
44
DB: "bezkoder_db"
55
};

app/controllers/auth.controller.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,13 @@ exports.signin = (req, res) => {
8989
});
9090
}
9191

92-
var token = jwt.sign({ id: user.id }, config.secret, {
93-
expiresIn: 86400 // 24 hours
94-
});
92+
const token = jwt.sign({ id: user.id },
93+
config.secret,
94+
{
95+
algorithm: 'HS256',
96+
allowInsecureKeySizes: true,
97+
expiresIn: 86400, // 24 hours
98+
});
9599

96100
var authorities = [];
97101

app/middlewares/authJwt.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@ verifyToken = (req, res, next) => {
1111
return res.status(403).send({ message: "No token provided!" });
1212
}
1313

14-
jwt.verify(token, config.secret, (err, decoded) => {
15-
if (err) {
16-
return res.status(401).send({ message: "Unauthorized!" });
17-
}
18-
req.userId = decoded.id;
19-
next();
20-
});
14+
jwt.verify(token,
15+
config.secret,
16+
(err, decoded) => {
17+
if (err) {
18+
return res.status(401).send({
19+
message: "Unauthorized!",
20+
});
21+
}
22+
req.userId = decoded.id;
23+
next();
24+
});
2125
};
2226

2327
isAdmin = (req, res, next) => {

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"dependencies": {
1919
"bcryptjs": "^2.4.3",
2020
"cors": "^2.8.5",
21-
"express": "^4.17.1",
22-
"jsonwebtoken": "^8.5.1",
23-
"mongoose": "^5.9.1"
21+
"express": "^4.18.2",
22+
"jsonwebtoken": "^9.0.0",
23+
"mongoose": "^6.11.2"
2424
}
2525
}

0 commit comments

Comments
 (0)