dimanche 3 juillet 2016

js spa rest backend bussines logic vs presention logic

I am very confuised about what should a SPA's REST backend do and expose, In most blog posts and books I read they depict the backend pretty much like a direct acess to the DB, practically CRUD methods that allow access to the DB after authenticating the user.

However I don't see where to put the actual bussins logic.

For example in a arbitrary screen that uses multiple resources, according to the CRUD way, I should do an ajax call to get all the data I need, filter and combine the data from all the different resources and use it. However, the way I combine and filter the data is sort of bussines logic and may change without any connection to actual presention (and vice versa)

Or when some button should start an async proccess in the server, which doesn't maps to CRUD nor to a DB table/collection

so my question is, what kind of services should a REST backend expose? and where do the bussines logic goes? should it be just a DB gateway with authentication, and all the bl will be in the javascript front end?

Aucun commentaire:

Enregistrer un commentaire