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

342
Vistas
server does not response data in Node JS

I write a router it is pretty straightforward it goes to service and the service connects to the database and the last router responds to a message and data but it doesn't show anything.

The router is like

router.get(
  "/:id",
  wrap(async (req: Request, res: Response, next: NextFunction) => {
    const id = parseInt(req.params.id);
    const result: any = await StudentService.get(id);
    res.status(200).send({
      message: 'Data serve successfully',
      data   : result
  })
  })
);

and the service class is

export class StudentService {
  constructor() {}

  async get(id: number) {
    const queryText = `select * from temp.student_info where id=$1`;
    const connection = await pgConnect.getConnection("slave");
    const result = await (
      await connection.query(queryText, [id])
    ).rows[0];

    return result;
  }
}

in response, it's just waiting but didn't give any data. if I write a console before res.status like below

router.get(
  "/:id",
  wrap(async (req: Request, res: Response, next: NextFunction) => {
    const id = parseInt(req.params.id);
    const result: any = await StudentService.get(id);
    console.log(result)
    res.status(200).send({
      message: 'Data serve successfully',
      data   : result
  })
  })
);

Then I can see the console but I did not get any response. how can solve this?

about 4 years ago · Juan Pablo Isaza
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