Hello! I am currently designing a basic invoicing and inventory solution, and I am using the MongoDB to save the invoices and Postgres for all accounting and inventory works. The problem is that, I can't find a reliable source to implement the pattern correctly. Currently my solution looks somewhat like this:
-> InventorySolution -> FrontEnd ->...(React stuff goes here) -> BackEnd -> Models (Model classes for Mongo and Postgres) -> Routes (Express Routes)
I am using Sequelize as ORM for Postgres and Mongoose as ODM for Mongo. The problem is that, saving an invoice to the database is an involved task. The app should take the invoice data and add records to multiple relations in Postgres and a document in Mongo as well. Adding a document to Mongo is quite simple, and hence most of the tutorials I have come across shove that part in the route.js file. But adding that logic to router seems plain wrong to me, and I would rather have all the database-related logic in a different directory. What is the common wisdom regarding this sort of problem?
As an aside, I was a WPF dev, and this application was previously built by me with WPF using MVVM and Repository pattern where the Unit of Work layer abstracted all the commits to database. I used Entity Framework, if that matters. I considered using Angular for a moment, but it seemed a little… heavy for my taste. React seems to be much more lightweight and I will have the option to use React Native and share the same codebase.
submitted by /u/Mycroft2046
[link] [comments]
from Software Development – methodologies, techniques, and tools. Covering Agile, RUP, Waterfall + more! https://ift.tt/39uZuC7