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

280
Views
cómo obtener los objetos req, res en las devoluciones de llamada

Me gusta obtener los objetos req, res, next fuera de la función de middleware.

middleware de muestra - muestra.js:

 var app = express(); .... ..... .... var updateUserInput = { init:function(){ get_data_from_db(params, function(){ // want req, res here. }) } } const processUserInput = function(req, res, next){ updateUserInput.init(); } module.exports = processUserInput;
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Debería poder pasarlos a la función de inicio de inmediato:

 var updateUserInput = { init:function(req,res,next){ get_data_from_db(params, function(){ // You will have req and res available here // finish processing and call next() }) } } const processUserInput = function(req, res, next){ updateUserInput.init(req,res,next); }
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!