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

339
Views
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
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!