Wednesday, 6 November 2019

[Question] What are some commonly used design patterns for Express apps?

Hi, this is a question for the senior Node developers here. I'm trying to advance my skills with Express and am wondering if there are any commonly used patterns, particularly for REST APIs.Coming from .NET Core (MVC) and Entity Framework, I'm familiar with Onion / Clean Architecture and the Repository and Unit of Work patterns. These are fairly ubiquitous and straight-forward to implement in C#.However, the Node courses and tutorials I've completed seem to produce code that is heavily coupled to the Express framework and the ODM / ORM. Controllers (routers) often to include validation and business logic and, rather than using DTOs, the Mongoose model is returned to the client. This is fine for small projects but would become problematic if the project needed to scale.The few examples I found where someone was using Express with the Onion or Clean Architecture were convoluted and didn't resemble anything I've seen in the .Net world. One promising example used TypeScript. However, for me anyway, it would be less work to just use C# and Web API. In any case, it doesn't seem like the latter patterns are widely adopted in the Node Express community.So, back to my original question: what architectural or design patterns (if any) do Node Express developers commonly use in larger scale apps? By that I mean patterns that developers generally agree upon, as opposed to something that worked for this particular development team or that one. Or, am I just chasing rainbows because Express is an unopinionated framework and everyone is doing whatever works for them?

Submitted November 06, 2019 at 07:56PM by 88_miles_per_hour_88

No comments:

Post a Comment