RESTful Backend – How coupled should my back end and front end be?

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.

0

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.

1

You should design your backend around the resources you are exposing from the backend.

These do not have to match up exactly to your model (the exposed resources and the internal model are two separate things), but often you will have a lot of overlap. For example you might have a “user” model object and a “user” resource exposed by the server.

A “resource” is an abstract concept, but it is important to have in your head what resources your server exposes to clients.

Once you have figured that out writing the client should be a doddle since the client simply requests the resources and does something with them.

To give an example of where resources and domain model don’t necessary completely over lap imagine a server that exposed a “student” resource to clients, but in the domain model there were actually 10 different objects that went into creating that resource (none of them called ‘student’)

So the resource url for a student looked like “/students/[id]” but when that was accessed the server created 10 different models, from Person to Grade, to School in order to build that single resource.

A lot of web frameworks, such as Django, map resources very closely to domain model which can make things easier (eg /students/[id] maps directly to a Student object in the model), but it is important to remember that this is not a requirement or sometimes not even a good idea.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật