lundi 7 juin 2021

Difference between Controllers in Rails vs NestJS

In Rails, the controllers are inherited from ApplicationController which uses Inheritance. Whereas, in NestJS, the Controllers are using Decorator Pattern.

I learnt that Decorator pattern is useful for dynamically adding responsibilities to an object.

But won't we know all the routes to be present beforehandl itself? Why should we go with Decorator pattern in this case?

Aucun commentaire:

Enregistrer un commentaire