Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

200
Vistas
Node JS API responds nothing on increasing request params and keeps sending the request to the server

I am using following api which responds nothing http://localhost:6150/api/v1/simpleSurveyData/abc/:projectId/:startDate/:endDate/:visitMonth

but, when i remove any of the four params or give less than four params. And adjust api route in node js accordingly server starts to response.

What i found is increasing params to four, my Node JS code does not come into the api route but although server does not give error but request just sending.

router.get("api/v1/simpleSurveyData/abc/:projectId/:startDate/:endDate/:visitMonth",
  async (req, res, next) => {
    console.log("first")

    try {
      console.log("first")
 
      res.status(200).send("response");
    } catch (error) {
      next(error);
      console.log(error);
    }
  }
);
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The problem is because you extract the data from url path NOT a query parameter. Please use query parameter. Example code below.

"api/v1/simpleSurveyData/abc/:projectId/:startDate/:endDate/:visitMonth" should be "api/v1/simpleSurveyData/abc?projectId=<projectId>&startDate=<startDate>&endDate=<endDate>&visitMonth=<visitMonth>"

Example express controller

export async function upvoteQuestion(req: Request, res: Response, next: NextFunction): Promise<void> {
    try {
        const questionId: string = req.params.question_id
        await db<Question>('question').where('id', questionId).increment('upvote', 1)
        res.status(200).json(<GeneralResponse>{
            status: responseStatus.success,
            message: 'Successfully vote up question'
        })
    } catch (error: unknown) {
        next(error)
    }
}

I extract the information of question id in url parameter by using req.params.question_id.

You can Google for more information.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda