You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
771 B
JavaScript

// This contains all the endpoints for our application
// We separate the routes such that "index.js" only contains information on the server
const express = require("express");
// Creates a Router instance that functions as a middleeare and routing system
const router = express.Router();
// [SECTION] Routes
// Route to get all tasks
router.get("/", (req, res) => {
// Invokes the "getAllTasks" function from the "taskController.js" file and sends the result back to the client/Postman
taskController.getAllTasks();
});
router.post('/', (req,res) => {
taskController.createTask(req.body).then(resultFromController => res.send(
resultFromController));
});
// Use "module.exports" to export the router object to use in the "index.js"
module.exports = router;