mardi 5 avril 2022

Is there a design pattern to write a dispatcher logic that calls specific methods based on given path?

We have a use case where we need to write a dispatcher class that takes the rest request object and should call the specific methods based on the request. For example we have a class Users that has methods to get, put, delete and post user data. We have another class Ledger that has methods related to ledgers add money, send money, create, delete etc. The dispatcher should take the request object and if the path is /users/* it should call the specific method in Users class. If the path is /ledger/* it should call the specific method in Ledger class. Is there a design pattern for such use cases?

Aucun commentaire:

Enregistrer un commentaire