1
0
Fork 0
mirror of https://github.com/docker/awesome-compose.git synced 2025-04-26 10:43:35 +02:00
awesome-compose/react-express-mongodb/backend/routes/index.js

16 lines
472 B
JavaScript
Raw Normal View History

const express = require("express");
const todoController = require("../controllers/todos/todoController");
const routes = (app) => {
const router = express.Router();
router.post("/todos", todoController.createTodo);
router.get("/", todoController.getAllTodos);
//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);
};
module.exports = routes;