Search code examples
javascriptnode.jsapimicroservices

If I have 2 APIs for the same webpage, it is called microservice?


I have done 2 APIs connected to the same DB and it runs together for the same web page, one is for the users and general data, and the other one is for manage the images, it takes and save it into a cloud service and the information of the image is saved in the DB.

I really don't have the enough knowledge in microservices so, I wish to know if that I've done is can be called microservice or it has another name.

Thanks so much for your advice.


Solution

  • Microservices should be self containing. NEVER EVER EVER should several applications / apis / whatever write into the same database.

    Each service is its own isolated island of thruth.

    Microservices is also not the you must go way. It is a possible way to go to prevent a super big monolith api.

    Most projekts I build use one api (service) and there was no need to split it up. The moment you have to split up a service (api) into microservices, you probably don't work alone anymore but in a team, because it's a huge project.

    However, If you choose to split apis, each of them has to have its own database and no other piece of software should be allowed to read or write data in it or from it directly but only through the api.

    EDIT: Hop it helps. If it sounds like I yell at you, I don't.