I encountered an error in my controller file with the following code snippet. It keeps saying that res.status is not a function.
Has anyone else faced this issue before? Interestingly, the function works fine when I include it directly in my routes file.
let User = require("../models/user.model");
function getAll (res, req) {
User.find()
.then(user => res.json(user))
.catch(err => res.status(400).json("Error: " + err));
}