Skip to content

Commit 3bd4477

Browse files
committed
Update
1 parent 10b895d commit 3bd4477

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

auth/src/app.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,12 @@ class App {
3434
setRoutes() {
3535
this.app.post("/login", (req, res) => this.authController.login(req, res));
3636
this.app.post("/register", (req, res) => this.authController.register(req, res));
37-
this.app.get("/dashboard", authMiddleware, (req, res) =>
38-
res.json({ message: "Welcome to dashboard" })
39-
);
37+
this.app.get("/dashboard", authMiddleware, (req, res) => {
38+
res.json({
39+
message: "Welcome to dashsboard",
40+
username: req.user.username,
41+
});
42+
});
4043
}
4144

4245
start() {

auth/src/services/authService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class AuthService {
3030
return { success: false, message: "Invalid username or password" };
3131
}
3232

33-
const token = jwt.sign({ id: user._id, name: user.username}, config.jwtSecret);
33+
const token = jwt.sign({ id: user._id, username: user.username}, config.jwtSecret);
3434

3535
return { success: true, token };
3636
}

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ services:
3737
depends_on:
3838
- mongo
3939
- rabbitmq
40+
4041

4142
order:
4243
build: ./order

0 commit comments

Comments
 (0)