Multiple frontends (clients) same backend

Viewed 1641

May be this pattern may sound old but how do we achieve a scenario in where we want to have a single backend (database), single business logic layer and have multiple frontends ? desktop, web and mobile ?

Something like modern apps have - gmail, facebook, evernote etc. Can this be done by writing microservices and having these different clients consuming it ?

2 Answers

Yes, you can create REST API for back-end containing business logic for data getting or submission. Type of data that is used for intercommunication between front-end and back-end can be JSON type. Types of requests that you should support in your REST API should be: GET requests should be used to return data from database, POST requests should be used to submit data in database, PUT/PATCH requests should be used to update data in database, DELETE requests should be used to delete data in database

Yes it absolutely can be done. Even if you have the back-end and front-end in the same framework at the end of the day when a request is made by a client from a different location to a remote server anyway, so once that initial response has been sent, it does not make much of a difference weather you have separate apps or one monolith app.

If the code base is small, you could dump multiple apps on the same machine.

This is what I am doing for a couple of projects which are not huge, I have one PHP backend and 2 front-ends one for Admin and the other for the User

Related