I have an api which is consumed by a mobile client (the app) and a browser client (back office). Now as it has started to grow and I need to keep it as clean as possible I will create two different api's one for back office and one for the app. The problem I found is that I do not want to duplicate code, I hate it I know is a bad practice for known reasons. So, the database is exactly the same, as you can image. I am using mongo with mongoose. So what I would like to achieve, at a high level would be something like this
DATABASE Api-1 Api-2
Both apis hitting the same database code.
I thought creating a different repo for the database, but I am just imagining and guessing because I dont really know how to approach to this. And if I create a different repo..how can I "import" it in both apis?.
I really appreciate your help, and every proposal or idea is more than welcome
Thank you in advance.
Aucun commentaire:
Enregistrer un commentaire