Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

422
Views
Obteniendo "TypeError: res.status no es una función".

TypeError: res.status no es una función en auth (D:\PROJECT\Web Application\Learning React\MERN STACK\middleware\auth.js:17:9). Estoy recibiendo este error. El código se da a continuación.

 const config = require("config"); const jwt = require("jsonwebtoken"); function auth(res, req, next) { const token = req.header("x-auth-token"); // Check for token if (!token) res.status(401).json({ msg: "No token, authorization denied" }); try { // verify token const decoded = jwt.verify(token, config.get("jwtSecret")); // Add user from payload req.user = decoded; next(); } catch (e) { res.status(400).json({ msg: "Token is not valid" }); } } module.exports = auth;

Captura de pantalla de error

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Debería ser req, res, next

Cambio

 function auth(res, req, next) {

para

 function auth(req, res, next) {

https://expressjs.com/en/guide/using-middleware.html

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!