I have the following in technology.route.js
:
router.delete('/', controller.deleteTech);
module.exports = router;
I have the following in technology.controller.js
const deleteTech = async(req, res, next) => {
const id = req.params.id;
try {
const result = await technologyService.deleteTech(id);
return res.json(result);
} catch (err) {
return next(err);
}
};
module.exports = {
deleteTech
};
And the following in technology.service.js
:
const deleteTech = (id) => {
return dbService.destroy(dbService.Technology, id);
};
module.exports = {
deleteTech
};
And the following in db.service.js
const destroy = (Model, id) => {
return new Model({ id }).destroy();
};
However when I try to make the request I get the error in the title for some reason:
await axios.delete(
${TECHNOLOGY}, prevTech);
//prevTech is an object wich has id as one of its fields.`
Any ideas?