Skip to content
Advertisement

Tag: express

Cannot set headers after they are sent to the client bug with Express and node-postgres

I’m stuck with the issue of sending response back to the caller after retrieving something from Postgres database. It appears that headers are automatically written after fetchUserDB is executed (regardless of its success). This leads to the error ERR_HTTP_HEADERS_SENT when I try to return the response back using res.json() menthod. These are the headers after fetchUsedDB is called (just before

Difficulties to make another route expressJS

I am doing a site as of my studies. The technology being free, I decided to code with nodejs/Express. For my first route /home, everything went well. But I can’t create others. Yet I thought I understood the system well. It would bother me if it was due to a silly error because I have been on this problem for

Resolve promise inside javascript map function

I have gone through several questions and posts regarding how to accomplish this but none have worked. I have tried an array (no pun intended) of possible solutions involving Promise.*, thenable, await and none have worked. I have an array of payments that I extract from a Prisma db call, the object looks like this: I am trying to run

Handling complex query parameters Express.Js

I’m making REST APIS with Express.js I have the following express route: /api/customer I added multiple query params to the route like this: In my controllers I handle all of these with If and there are so many cases I feel that this method would not scale, is there a better way of handling this ? This is the code

API call in express says maximum rows exceeded

I have an express app that makes an api call and prints out the results like so: The issue now is that once the API call is made, the result says Limit for result exceeded, max rows: 25.00 thousand, current rows: 40.11 thousand I know that you can increase the file size, but I don’t think that also increases the

Get buffer from post body in Expressjs

I am making an express application that handles post data. Because the request body could be any content type and/or binary, I would like req.body to be a Buffer. So what should I use to get a Buffer that represents the request body? Here is my code: Answer body-parser can help achieve this, code example would be as, See more

Advertisement