All Questions
21 questions
0
votes
1
answer
60
views
Registering a user and login
I have these following controller functions for registering a user and login, in my app, and I want to make it more clean and maintainable.
Probably by using ...
2
votes
1
answer
239
views
HMAC Middleware
I have been programming a middleware for my small application that verifies if an authentication header is present and verifies the HMAC present in it. I would like to know what I could optimize in ...
3
votes
1
answer
4k
views
Nested loop with synchronous and asynchronous behavior
The problem is as follows. I have an array of objects like so:
...
0
votes
1
answer
63
views
Running arbitrary number of mongo queries in nodejs
I am faced yet again with a callback headache:
Simply I need to return to the client the results of multiple mongo queries, the number of which I don't know in advance.
In short:
fetch the first ...
0
votes
1
answer
51
views
Implementation of callback in database request
I am a complete beginner in JavaScript / Node.js / Express, but have some experience with php.
I am trying to pass data from a SQLite database to the console. In my previous attempts, ...
4
votes
2
answers
121
views
Initialising accounting groups
This deeply nested set of callbacks is very unreadable and I'm looking for ways to improve it:
...
1
vote
1
answer
130
views
Using JavaScript callback to conditionally send email
I have an app where users at some point select the amount of tasks they have completed. If they have only completed 3 or less then 3 tasks then I send an email to the system admin to inform them.
But ...
2
votes
1
answer
2k
views
async.waterfall call
Does anyone have any recommendations for how I could make this async.waterfall call neater? Ideally I'd be able to do something like:
...
1
vote
2
answers
998
views
Avoiding nested callbacks when using MongooseJS
I'm diving into the world of nodejs and mongo. I am playing around with a simple app that uses MongooseJS to talk to Mongo. I have been looking at examples and some GitHub projects for references, but ...
3
votes
1
answer
393
views
From Callbacks to Promises - MEAN Stack
I have a MEAN Stack app in which I have been using mongoose routes to update my data. Some of those routes have a lot of back and forth in terms of updating data across multiple users and collections. ...
2
votes
1
answer
142
views
Input-reading library for Node.JS
Recently I have been busy with nodejs and I thought to create something like this Java input library, so I started with some rough code like below:
...
2
votes
0
answers
602
views
Saving parsed CSV data to MongoDB
I wrote a script for reading a CSV, parsing it and saving data to MongoDB. I would love some input on how I'm handling errors and dealing with callbacks. I wrote it with nested without using async and ...
2
votes
1
answer
37
views
Parallel computation to be merged, depending on single call
Steps:
Get AMOUNT from a call to API endpoint /a, e.g. AMOUNT == 5 (in the code it is set to ...
2
votes
1
answer
505
views
Handling callbacks when doing async programming and dealing with scope
I'm using HapiJS to create a little backend for my side-project. In grabbing RSS feeds, I want to loop through my list of website URLs, grab the correct RSS links in the ...
2
votes
1
answer
240
views
Conditional callback for asynchronous file copy
I'm trying to figure out the most elegant solution to do the following asynchronously using JavaScript (specifically node):
Given a destination file name, check if it is a directory
If it is a ...