RESTful Backend – Coupling Between Back End and Front End

restweb servicesweb-apiweb-applicationsweb-development

I'm creating a web application with a front end client written in angular as well as a back end that I'm writing in Django (there are reasons I picked the frameworks but they are irrelevant to my question).

I have my front end planned out down to every page that will be available. I currently am only going to implement the angular cient but in the future I plan on implementing a native android and iOS app for learning purposes.

My question is how coupled should my back end design be with my front end client?

Should I design my endpoints on a per view basis?
This seems like back end will need work when I create another client.

Or should my endpoints be more focused around exposing CRUD functionality for my models?
This seems like it would leave room for creativity and make the back end more flexible.

These are a few of the questions I have been asking myself and I provided them to add a little more scope to my question.

Even if I went with the crud approach it seems like I will still be implementing specialized endpoints for handling common application features.

Thanks in advance.

Best Answer

If each client you intend to service requires different output from your back end. Then write your back-end in a way where is can serve each type.

Do some abstraction. Ask yourself, what things will all clients need the same way, and what things will each client need in a specific different way.

Put all the stuff that is the same for all clients together, and then write an interface for each client that handles the differences for that client. These interfaces will get all content from the same module, but adapt serving that content to the specific clients needs.

Related Topic