I am using AWS Lambda and serverless framework to build a service which uses S3 to store a file. The lambda function (“hello”) works perfectly when deployed to the cloud (it has an http endpoint, I invoke it from the browser). On the contrary, when invoked locally (serverless invoke local –f…
Tag: node.js
are static variables “thread safe” in javascript
I am making a node.js web server that handles large payloads, computations and copies, for example I need to with a deep copy of a large object: now this works fine and with every request context I can create 1 new deep copy and work with that in the class. But my class is becoming big and unstructured so I
How to identify a pattern in a string in nodejs
I have the following problem that I have not been able to solve for several hours: What I want to do is that when I receive a string, identify a pattern in said string and be able to use it later, for example when receiving the text: “Hello this is an example message, the hashtag of the day is #Phone,
Return results in a nested object
I am trying to loop through the req.body that has data and I am trying to return the bookStatus of all the books present inside the body. I am doing this: This returns the bookStatus of all the books, but it is just the value of the bookStatus key. I am trying to get the key as well, for it
editing a JSON in JS and putting it in an array
so I have the following json. I need to remove the items that don’t have a value in the “available” field (such as NEO and ETH and set the result in an array. Then remove the onOrder and btcTotal fields. such as: BTC 0.00024868 0.00024868 BNB 0.8943066 0.0004663808919 I am writing my little …
How to send CSV data from Neo4j query results through Node.js/AdonisJs
Currently, I have some code that query from Neo4j database then write to a CSV file on server: const session = driver.session(); const query = ‘‘; var file = fs.createWriteStream(‘…
how to launch puppeteer with an already existing profile multiple time
so am trying to launch puppeteer with already existed chrome profile and it works , but what i want to do is to launch the same process multiple time which throw an error (node:12820) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process! [0311/152606.490:ERROR:chrome_main_delegate.cc(…
Cannot POST image to my API Route from React.js
I am creating a MERN app in which I have created an api route /api/books where user can POST a book’s details with it’s image, and the data will be stored in MongoDB. I am using multer and it stores the image after encoding in binary format in the database. When I test it with postman, I works per…
login rest api using express giving HTML content error in postman
I am trying to create a simple login api using node js and express, however postman is giving the following error however my signup api is working fine and I can create my user profile and am getting response code that I have written for login is as follows: signup api: routes are as follows: I am very new to
Should I write all my route handling code in a try-catch block?
Is this good use of try…catch, or should I write everything in try block? I am trying to prevent nested try…catch blocks. Answer You’ll never need to nest try/catches – a catch() will catch all errors underneath it. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/t…