Skip to content

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

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

Unable to load CSS file within nodeJS app

I have an app that I followed from a tutorial for the backend in nodeJS and Express. My connection to MongoDB via Mongoose is working. However, I’ve been trying to add a front-end- at the moment- just a simple html/ejs/css form. My endpoints are loading in localhost but only the html/ejs is rendering. My css file shows as plain code