April 2020
Intermediate to advanced
716 pages
18h 55m
English
In the backend, we will need an API that allows an existing course to be updated if the user who is making the request is the authorized instructor of the given course. We will first declare the PUT route that accepts the update request from the client, as follows:
mern-classroom/server/routes/course.routes.js:
router.route('/api/courses/:courseId') .put(authCtrl.requireSignin, courseCtrl.isInstructor, courseCtrl.update)
A PUT request that is received at the /api/courses/:courseId route first checks if the signed-in user is the instructor of the course that is associated with the courseId provided in the URL. If the user is found to be authorized, the update controller is invoked. The update method in the course controller ...
Read now
Unlock full access