I have a little question. I would like to check when a user was logged in the last time. If the account is inactive it will be deleted from the database. I have no clue how to implement this. or how to check the time the user has logged in the last time. Can someone help me, please… I would
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
NodeJs Testrunner freezes / stops when setting up Express server
I’m using Node v18 with the experimental testrunner. I use express as a dev dependency for http integration tests which works fine but there is one test freezing or stopping the testrunner ( it doesn’t continue ) I’m using TS but can also reproduce it with JS, the test file HttpTests.js contains Running this with the npm script “test”: “node
Prevent node.js from converting a nested object with numeric keys into array
When i have an object with a nested object within, whose keys are numbers and send it to my node.js server, then the nested object is converted to an array. How can i prevent this ? Client: Server: { new: [ ‘Test’, ‘Hello’ ] } When i add a not numeric key, everything works fine. Also when the keys are
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
HTML content displayed as pure string instead of getting rendered as a website
Hello I am getting started with implementing APIs in my project to build a Weather reporting project.This is my .js script. Now I get the response of the post request as this is as a string but i want it yo render it like a website. Instead, when I do respond in this order the html is rendered just fine.
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