PUT http://localhost:4000/api/plot 404 (Not Found) error

I have the following in plot.controller.js

const create = async(req, res, next) => {
    try {
        console.log(req, "request") 
        //console.log(req.body, "body")
        const result = await plotService.create(req.body);
        console.log(result, "result")
        return res.json(result);
    } catch (err) {
        return next(err);
    }
};
const update = async(req, res, next) => {
    try {
        const id = req.params.id;
        const result = await plotService.update(req.body, id);
        return res.json(result);
    } catch (err) {
        return next(err);
    }
}

I have the following in plot.route.js :

const express = require('express');
const controller = require('../controllers/plot.controller');
// Access parent params from endpoints
const router = express.Router({
    mergeParams: true
}); // eslint-disable-line new-cap

router.post('/', controller.create); //working fine
router.put('/:id', controller.update); //causing issue

module.exports = router;

And the following in plot.service.js :

const dbService = require('../common/db.service');
/**
 * @param {String} id 
 * @returns {String} 
 */
/**
 * @param {object} object of fields to search by
 * @return {promise} user model || error
 */
const create = (params) => {
    return dbService.create(dbService.Plot, params);
};

const update = (params, id) => {
    return dbService.update(dbService.Plot, id, params);
};

module.exports = {
    create,
    update
};

And the following in db.service.js

/**
* Create a new row in the database
* @param {object} Model type
* @param {object} data to save
* @return {object} DB Model
*/
const create = (Model, data) => {
    return Model.forge(data).save(null).catch(SQLError);
};

/**
* Update a row in the database
* @param {object} Model type
* @param {int} id of row
* @param {object} data to save
* @return {object} DB Model
*/
const update = (Model, id, data) => {
    return new Model({ id }).save(data).catch(SQLError);
};

module.exports = {
    create,
    update,
    ...Models
};

This is how I make the post request which is working fine:

try {
      const plot = await axios.post(`${PLOT}`, plotRequestBody); //plotRequestBody is defined

However when I try to make the put request

 try{
  await axios.put(`${PLOT}`, plotRequestBody);

Since everything is being used in the same files I’m not sure why I get the error in the title and for the put request. Thanks for any help!

You’re not passing id in the PUT request.

Sorry, I had forgotten to add the code for controller.js, as you can see it extracts id from the params. This is my let

projectRequestBody = {
      name,
      type,
      status,
      client,
      owner,
      architecture_notes,
      recommendations,
      id
    };

Your PUT route expects id in url, and you’re not sending one, therefore router.put doesn’t match.