Creating A Book Listing - Implementation
1 - Route Name
const express = require('express')
const router = express.Router()
const { getAllBooks, getBookById, createABook } = require('../controllers/book')
router.get('/', getAllBooks)
router.get('/:id', getBookById)
// This is the new route we are adding in
router.post('/', createABook)const catchException = require('../../utils/catchExceptions')
/**
* Creates a new book listing.
*/
const createABook = catchException(async (req, res) => {
// we'll fill in the details after we get each of the other layers ready
})
module.exports = createABook2 - Input Request
3 - Middleware
4 - Validation
5 - Domain
6 - Events
7 - Response
Last updated