I recently came across a demand to create a web system (which will be done in PHP, but is for any language), to have the same functionalities of a mobile application already ready. This app has a complete and well written API in NodeJS.
With this situation, I had a question about the possibility of using the API in the system too, rather than connecting this directly to the database and rewriting all the functions already in the API.
To better illustrate what I mean, here are the two methods:
More common:
System -> Database
APP -> API -> Database
That is, a system in php connects directly to the database, while an app (for security reasons and in order to avoid reverse engineering) has the API as an intermediary. However, considering that I come across a fully functional and functional API here, I thought of this new method:
System -> Api -> Database
APP -> API -> Database
The major drawbacks I see in doing this would be the fact of losing performance, since a direct connection would be much faster than making a request and handling the response. However, the advantage of having just one maintenance area (the API) catches my attention.
What other disadvantages would I have in this method?