Skip to content

Commit

Permalink
add routes
Browse files Browse the repository at this point in the history
  • Loading branch information
gungunfebrianza committed Aug 17, 2021
1 parent 7d97d1d commit 8c4947c
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Example-1/routes/tutorial.routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module.exports = app => {
const tutorials = require("../controllers/tutorial.controller.js");

var 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);

// Delete all Tutorials
router.delete("/", tutorials.deleteAll);

app.use('/api/tutorials', router);
};

0 comments on commit 8c4947c

Please sign in to comment.