2020-05-12 15:16:03 +02:00
|
|
|
const express = require("express");
|
2024-02-21 10:16:49 +08:00
|
|
|
const todoController = require("../controllers/todos/todoController");
|
2020-05-12 00:40:39 +05:00
|
|
|
|
|
|
|
const routes = (app) => {
|
2020-05-12 15:16:03 +02:00
|
|
|
const router = express.Router();
|
2020-05-12 00:40:39 +05:00
|
|
|
|
2024-02-21 10:16:49 +08:00
|
|
|
router.post("/todos", todoController.createTodo);
|
2020-05-12 00:40:39 +05:00
|
|
|
|
2024-02-21 10:16:49 +08:00
|
|
|
router.get("/", todoController.getAllTodos);
|
2020-05-12 00:40:39 +05:00
|
|
|
|
2020-05-12 15:16:03 +02:00
|
|
|
//it's a prefix before api it is useful when you have many modules and you want to
|
|
|
|
//differentiate b/w each module you can use this technique
|
|
|
|
app.use("/api", router);
|
2020-05-12 00:40:39 +05:00
|
|
|
};
|
2020-05-12 15:16:03 +02:00
|
|
|
module.exports = routes;
|