Angularjs is so powerful, and MVC and other functions are implemented in the frontend. To get data, do you usually use $http to get it from the backend? Are there any other ways to get it? In this case, wouldn’t the backend just have to write APIs?
What are the general frameworks for writing APIs in PHP? Laravel seems to be very cheating, but it has a template engine, is it suitable?
It’s better to write directly without a framework
Sorry I don’t have enough reputation to like it! o(╯□╰)o
NG is an MVVM front-end framework. Ideally, it would achieve complete separation of the front-end and back-end, and only provide APIs in the backend. The decoupling of front-end and back-end is achieved. This decoupling allows us to develop independent front-end and back-end applications. The browser's way of consuming back-end API is also suitable for mobile devices such as Andoird iPhone. When we develop front-end applications, the back-end programming language is no longer needed, only HTML/CSS/JS is needed, which is a liberation for most front-end developers.
This is a great thing. And personally, I think it can’t just be attributed to Angular, it also has a lot to do with the widespread acceptance of RESTful style interfaces
All frameworks, designs, and projects ultimately have only one direction: Let everyone focus on their own field
Before Angular, there were also front-end frameworks for SPA (Single Page Application), such as extjs, which also placed the entire view layer on the browser side.
SPA’s development method solves a very important maintenance pain point: Dirty areas of front-end and back-end templates. In the past, this area needed to be jointly maintained by the front-end and front-end, but now it is no longer needed. Back-end engineers no longer need to directly participate in the presentation Layer is working
However, since there is no widely recognized interface style, it is still inevitable to consider the presentation layer when designing the interface, making it difficult to reuse. The most common situation is to repeatedly develop multiple sockets for similar back-end resources, which is actually a waste of precious time of back-end engineers.
It can be said that ensuring back-end engineers
只管写接口,只管把接口写好
from an engineering perspective is a huge liberation of back-end productivity.To achieve this, it is necessary to have a set of interface styles that are generally accepted by the front and back ends, which can meet the needs of cross-page and even cross-platform resource access, and at the same time have good semantics and cacheability
The answer is RESTful
With the widespread acceptance of RESTful style interfaces, the front-end does not need to consider what back-end to cooperate with at the framework level, as long as it accesses RESTful resources. Backend engineers are completely decoupled from the presentation layer, whether the client uses angular/backbone or mobile. Just write the interface and write the interface well
When everyone focuses on their own field, that’s when value is maximized
Theoretically yes,
If your application is made into a SPA, then the backend only needs one root route to render the page. The rest are API routes.
But in actual projects, whether SPA is easy to use and whether there are many pitfalls, then it is necessary to combine the back-end hybrid routing with the front-end SPA.
The backend just writes an API, which is almost like this