Monday 29 February 2016

How to structure node.js/express application?

So, I've been learning node.js for some time and I'm a bit struggling with lack of patterns on how to structure the application. I'm coming from Java background.I have a classical web app - it exposes REST API in the routes. Routes are essentially controllers from MVC so I keep them very light.App has some complex business logic computation. In Java/Spring world controller would call stateless service objects which would perform the business logic on POJOs (anemic data model). These POJOs would be accessible through stateless repository (DAO) objects to abstract the entity implementation details (maybe they come from DB, maybe from another microservice).Of course I can do it like this even in node.js, but it doesn't seem to be the normal (idiomatic) way to do this. Maybe the business logic is usually implemented in more OO way (DDD?) What's your approach to design in node?

Submitted February 29, 2016 at 09:24PM by GSV_Little_Rascal

No comments:

Post a Comment