Retrieving A Book By ID - Implementation
1 - Route Name
const express = require('express')
const router = express.Router()
const {
getAllBooks,
getBookById
} = require('../controllers/book')
router.get('/', getAllBooks)
router.get('/:id', getBookById) // This is our newly added route
module.exports = routerconst catchException = require('../utils/catchExceptions')
const getBookById = catchException(async (req, res, next) => {
// our code goes here...
})2 - Input Request
3 - Middleware
4 - Validation
5 - Domain
6 - Events
7 - Response
Last updated