April 2020
Intermediate to advanced
716 pages
18h 55m
English
The two auth APIs are defined in the auth.routes.js file using express.Router() to declare the route paths with the relevant HTTP methods. They're also assigned the corresponding controller functions, which should be called when requests are received for these routes.
The auth routes are as follows:
The resulting mern-skeleton/server/routes/auth.routes.js file will be as follows:
import express from 'express'import authCtrl from '../controllers/auth.controller'const router = express.Router()router.route('/auth/signin') .post(authCtrl.signin) ...Read now
Unlock full access