lundi 29 janvier 2018

How to architecture a "plug-in" kind design pattern in JS?

I am building a JS application and I was wondering how to architecture a part of it. Here is my problem, I have to call some API's that will: - check and email address - check an address - check some numbers - etc...

For each of these checks, two different API's from different services will be called. How can I architecture my application so that I can have a "plug-in"/"module"/"adapter" kind of code, so that if one day I decide to change the third party API service I just have to write a specific class for that API and let the rest of the code as it is?

I also imagined to do something like: I create a function called checkEmail(email) and behind scenes he's going to call the different API's.

Aucun commentaire:

Enregistrer un commentaire