I'm starting in Node.js and I searched a lot about transaction control , but I did not find anything like what I'm used to in Java.
First I'll clarify what I mean by transaction control: Imagine a complex operation where business logic is separated into 2 or more services (or modules or files, etc.), each service interacts with the bank and can make changes. If an error occurs in any of the services, everything must be rolled back so that there is no inconsistent data in the database.
A classic example of where transaction control is important is a bank transfer, two transactions are required, debit to one account and credit to another, or both occur successfully or none can be effected.
In Java, frameworks like Spring support transaction control in a very simple and transparent way for the developer, that is, making the correct settings, no need to worry about it anymore, the framework does all the control: Starts the transaction and commits or roolback as needed even when the logic is distributed across multiple services.
I looked for some framework that did the same in Node.js, but the closest thing I found was the 'Promises', which basically allow you to execute various bank operations in an orderly way and in case of an error rollback, however when the logic is distributed in several services the Promises are not enough.
The question is: is there a framework or technique for Node.js that is capable of doing this control, or is Node.js simply not a good choice for applications that require transactional control?
I'm using MySQL database and the mysql2 lib ( link )