-
Notifications
You must be signed in to change notification settings - Fork 185
Expand file tree
/
Copy pathuser.routes.js
More file actions
31 lines (27 loc) · 789 Bytes
/
user.routes.js
File metadata and controls
31 lines (27 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const { authJwt } = require("../middlewares");
const controller = require("../controllers/user.controller");
module.exports = function(app) {
app.use(function(req, res, next) {
res.header(
"Access-Control-Allow-Headers",
"x-access-token, Origin, Content-Type, Accept"
);
next();
});
// Get contents for public
app.get("/api/test/all", controller.allAccess);
// Get contents for all users
app.get("/api/test/user", [authJwt.verifyToken], controller.userBoard);
// Get contents for moderators
app.get(
"/api/test/mod",
[authJwt.verifyToken, authJwt.isModerator],
controller.moderatorBoard
);
// Get contents for admin
app.get(
"/api/test/admin",
[authJwt.verifyToken, authJwt.isAdmin],
controller.adminBoard
);
};