Hello, I'm struggling to design my database. There are many types of financial transactions and each is stored in its own table. When it comes to calculating user's balance I ...
Hello, I'm working on an app involving money. Every money involving action creates a record, from which the overall user's balance can be calcuated. There are many ways for th...
I’m new to REST API and I was wondering if my resources that I model should mimic the structure of the database? For example, there’s a property called “balance” for my users ...
Hello, I need to loop through an array of unknown length, that I can get in peices from requests. For example I can get 1000 values every time and ask 1000 next items and ther...
Can you please elaborate? Say I'm running a server on NodeJS. A user has a balance of 10 dollars. What if they send 2 requests to withdraw their balance at the same time? As t...
Hi, Is there a way to select a common field from 2 tables so the output conitains only one row? For example if two tables have fields amount and user_id and I want to select ...
Hey, so does anyone know if having mulitple apis is a good idea? These will be the same express apps with the same auth process and validations, but different end points. Ther...
If I have 2 services running, one private and one public and I want my public service to iteract with my private service, what's the best way of confirming that the private se...
What's the equivalent of the Web API in NodeJS? Am I correct for thinking that these are functions outside the JS thread, but inside the JS runtime, that take in a JS function...
For sql databases is there a way to set some kind of triggers on my variables? I have this one variable in my db which is a number and I want to make sure it can only go up by...
Yeh, I'm concerned, the stack will have 2 of them and this might go further. So something like: let f = async () => {}; let b = () => f().then(() => setTimeout(b, 1000)).catch...
How do I perform something like: if(a === b){return c}else if(a === d){return e}else{throw} in one line?
What are good libraries for queues? I need to process transactions in order because otherwise users will be able to use up more funds than they had, if 2 requests are processe...
Do you guys think a code like this is readable enough?
I can't use json and multipart together, so what's the best practice? Have an api endpoint to consume images only and spit out references to include them in json body? Or enco...
Hi, I need to fork some nodejs scripts in regular intervals only if the last spawned process has exited. What's the best way to do this?
For real time applications, do you think its fine to have all the action done thorough HTTP Rest, but have a mechanism to listen to all the database changes and then stream th...
The behaviour before was exactly the same. It's just that I didn't expect it to throw an error about a deadlock, instead I though one should wait for another to complete. Isn'...
What if that something can be found only by requesting? How can I find if something has changed if I need to request it first?
So the db gurantees that the checks inside 2 separate transactions will come one after another, but never at the same time?