This commit is contained in:
Yûki VACHOT 2021-10-29 11:22:24 +02:00
parent 4dfd8cd516
commit 5a64568824
22 changed files with 702 additions and 194 deletions

View file

@ -0,0 +1,28 @@
module.exports = app => {
const tutorials = require("../controllers/tutorial.controller.js");
let router = require("express").Router();
// Create a new Tutorial
router.post("/", tutorials.create);
// Retrieve all Tutorials
router.get("/", tutorials.findAll);
// Retrieve all published Tutorials
router.get("/published", tutorials.findAllPublished);
// Retrieve a single Tutorial with id
router.get("/:id", tutorials.findOne);
// Update a Tutorial with id
router.put("/:id", tutorials.update);
// Delete a Tutorial with id
router.delete("/:id", tutorials.delete);
// Create a new Tutorial
router.delete("/", tutorials.deleteAll);
app.use('/api/tutorials', router);
};

View file

@ -0,0 +1,27 @@
const users = require("../controllers/user.controller");
module.exports = app => {
let router = require("express").Router();
// Create a new User
router.post("/", users.create);
// Retrieve all Users
router.get("/", users.findAll);
// Retrieve a single User with id
router.get("/:id", users.findOne);
// Update a User with id
router.put("/:id", users.update);
// Delete a User with id
router.delete("/:id", users.delete);
// Delete all Users
router.delete("/", users.deleteAll);
// Authenticate a User
router.post("/auth", users.auth);
app.use('/api/users', router);
};