April 2020
Intermediate to advanced
716 pages
18h 55m
English
The server/controllers/user.controller.js file will contain definitions of the controller methods that were used in the preceding user route declarations as callbacks to be executed when a route request is received by the server.
The user.controller.js file will have the following structure:
import User from '../models/user.model'import extend from 'lodash/extend'import errorHandler from './error.controller'const create = (req, res, next) => { … }const list = (req, res) => { … }const userByID = (req, res, next, id) => { … }const read = (req, res) => { … }const update = (req, res, next) => { … }const remove = (req, res, next) => { … }export default { create, userByID, read, list, remove, update }
This controller will make use ...
Read now
Unlock full access