All Questions
71 questions
2
votes
1
answer
115
views
Basic node login routes for authentication system
I am building a basic authentication system with a node backend and wonder whether I am using the try-catch block excessively. I have this example controller:
...
2
votes
0
answers
297
views
JavaScript proxy for better stack traces from external libraries
I've been using the excellent pg-promise library for a few years now, but my primary irk with it is that the stack traces are sometimes unhelpful. For example, the following test will fail (currently ...
1
vote
1
answer
2k
views
NodeJS promise loop through all files in directory
I am trying to re-organise my mp3 collection based on its id3 meta data into folders based on the artist. I'm new to nodeJs and more importantly promises. I was hoping I could get some feedback on my ...
2
votes
0
answers
669
views
Handling Promise that resolves but returns a 404
This is in a node and express API. I'm trying to figure out the best way to handle Promises that resolve, but return a 404 response. I have a method which uses node-fetch to make a POST call to update ...
4
votes
1
answer
275
views
Correctly using promises with node-mysql
I have been trying to do a simple query and return the results with node-mysql however I had several problems. Originally I wrote it where there was no promise, but ...
-1
votes
1
answer
490
views
JavaScript promise optional chaining [closed]
I've wrote a piece of code today that really make me sick about:
...
0
votes
1
answer
64
views
Making two sequential asynchronous requests using promises
The following code is making two asynchronous requests to obtain the desired data. The second request needs to access the data from the first request, hence I need to nest it. I know that it is better ...
0
votes
1
answer
49
views
Handling a PUT API call to write to a database using promises
The following function is accepting PUT connection to a server API, checks authorization to write and then performs write to a database.
The eslint linting tool ...
3
votes
1
answer
444
views
Separating Fetch Calls and using in Promise Chain
I´m currently working on a small microservice application, which will in it´s simplest form just receive a Request from a Formular and and based on containing information perform several other Server-...
3
votes
1
answer
61
views
JavaScript that deletes everything inside a folder on Box.com
I just finished a simple script for Node that will delete all the folders and files inside a specified folder ID through Box's API. It works by getting a list of items inside a folder, then generating ...
5
votes
2
answers
2k
views
Extending native JavaScript Promise with cancellation support
Updated, below is a more current and simple version of this. Also, if you track the progress of TC39's "ECMAScript Cancellation" proposal, this thread might be worth checking out.
I'm ...
3
votes
1
answer
175
views
Basic ethereum transfer codes using web3js, ganache, node
I want to get advice about functional programming using javascript promise. Please look through my code and give me a feedback how I could make code better. As I begin to use promise a few days ago, ...
3
votes
2
answers
2k
views
Using await to break long-running processes
I have a Node.js app / Web API that runs on an Azure app service with a single CPU.
One of the functions needs to run for a long time, perhaps tens of seconds, while the server should continue to ...
2
votes
3
answers
842
views
Fetching user details, posts, and comments using promises in ExpressJS
I'm creating an API service in NodeJS using Express (version 4) Framework. Created an MVC architecture for the same (no views, only model, and controller as this is an API).
Also, there are routes. ...
1
vote
1
answer
274
views
ExpressJS with Promises and Ethereum
I am making a small token project with front-end website to ease the use. The architecture is Ethereum private network with ERC20 contract, PostgreSQL to associate address with alias of wallet, NodeJS ...