This commit is contained in:
Yûki VACHOT 2021-11-01 19:53:21 +01:00
parent 4138c22051
commit e17adfcfa5
11 changed files with 193 additions and 83 deletions

View file

@ -3,28 +3,37 @@ module.exports = app => {
let router = require("express").Router();
// Create a new User
router.post("/user", users.create);
router.post("/user/create", users.create);
// Retrieve all Users
router.get("/users", users.findAll);
router.get("/user/findAll", users.findAll);
// Retrieve a single User with id
router.get("/user/:id", users.findOne);
// Retrieve a single User with id if admin
router.get("/user/findOne/:id", users.findOne);
// Update a User with id
router.put("/user/:id", users.update);
// Retrieve a single User with session id
router.get("/user/findOne", users.findOne);
// Update a User with id if admin
router.put("/user/update/:id", users.update);
// Update a User with session id
router.put("/user/update", users.update);
// Delete a User with id
router.delete("/user/:id", users.delete);
router.delete("/user/delete/:id", users.delete);
// Delete all Users
router.delete("/users", users.deleteAll);
router.delete("/user/deleteAll", users.deleteAll);
// Authenticate a User
router.post("/user/auth", users.auth);
// Logout a User
router.delete("/user/logout", users.disconnect);
router.delete("/user/logout", users.logout);
// Get all Roles depending on the role of the User
router.get("/user/roles", users.roles);
app.use('/api', router);
};