node js type error code example

Example 1: node js type error

TypeError: res.status is not a function
    at C:\Users\lenovo\Desktop\MERN\backend\app.js:16:8
    at Layer.handle_error (C:\Users\lenovo\Desktop\MERN\backend\node_modules\express\lib\router\layer.js:71:5)
    at trim_prefix (C:\Users\lenovo\Desktop\MERN\backend\node_modules\express\lib\router\index.js:315:13)
    at C:\Users\lenovo\Desktop\MERN\backend\node_modules\express\lib\router\index.js:284:7
    at Function.process_params (C:\Users\lenovo\Desktop\MERN\backend\node_modules\express\lib\router\index.js:335:12)
    at Immediate.next (C:\Users\lenovo\Desktop\MERN\backend\node_modules\express\lib\router\index.js:275:10)
    at Immediate.<anonymous> (C:\Users\lenovo\Desktop\MERN\backend\node_modules\express\lib\router\index.js:635:15)
    at processImmediate (internal/timers.js:458:21)


reason:-(error,res,req,next)  order of argument is incorrect req after before res
solution:-(error,req,res,next)

Example 2: node js type error

TypeError: res.status is not a function
    at C:\Users\lenovo\Desktop\MERN\backend\app.js:16:8
    at Layer.handle_error (C:\Users\lenovo\Desktop\MERN\backend\node_modules\express\lib\router\layer.js:71:5)
    at trim_prefix (C:\Users\lenovo\Desktop\MERN\backend\node_modules\express\lib\router\index.js:315:13)
    at C:\Users\lenovo\Desktop\MERN\backend\node_modules\express\lib\router\index.js:284:7
    at Function.process_params (C:\Users\lenovo\Desktop\MERN\backend\node_modules\express\lib\router\index.js:335:12)
    at Immediate.next (C:\Users\lenovo\Desktop\MERN\backend\node_modules\express\lib\router\index.js:275:10)
    at Immediate.<anonymous> (C:\Users\lenovo\Desktop\MERN\backend\node_modules\express\lib\router\index.js:635:15)
    at processImmediate (internal/timers.js:458:21)


reason:-(error,res,req,next)  order of argument is incorrect req after before res
solution:-(error,req,res,next)