Premise: The business has been split into a number of micro services
Questions? Does the client and the Web need to maintain two sets of API code? Is it reasonable to use cross-domain or intra-service forwarding if only one set of APIs is maintained?
Reply content:
Premise: The business has been split into a number of micro services
Questions? Does the client and the Web need to maintain two sets of API code? Is it reasonable to use cross-domain or intra-service forwarding if only one set of APIs is maintained?
I answered this question in the way discussed.
Our current app and web (PC and mobile page) as far as possible with the same set of APIs, we also do not encapsulate so many microservices at this stage, so the application layer and service layer without clear isolation are unified called data api! Also as you consider the maintenance cost problem, so even if the app home page and homepage UI the same situation, in order to improve the app data loading speed may require n requests at the API layer wrapper into a separate API and then call a public API once return all the JSON data required by the home page, The data is loaded except for some pull-down!
In addition you say cross-domain I feel, you want to use AJAX to directly request your service API, this I feel unreasonable, must in the project with back-end language again call Data API, so there is no cross-domain problem is also more secure, the equivalent of your client project is your application layer!
We have also recently encountered a tangled problem, iOS during the audit period, the new API must be released, but we even from the business perspective of incompatible old version, the iOS in the old version of the audit will still request an error, so we think of two is not particularly good program, one is the procedural logic compatible, For the new person is definitely a disaster, and the other is always let the app version corresponding to a set of API version, so the physical code will be more than a copy, the source is very bloated compared head big, so take this paste welcome to discuss the API multi-version maintenance issues!
In general, the RESTful API design pattern is now used to maintain a set of APIs that clients can access through cross-domain requests.
No, as long as you maintain the same API authentication method, such as the access interface needs to bring Access_token
Whether you use cross-domain or internal forwarding is a plan, since your system has been split into two pieces, the interface is naturally two separate interfaces, and the client should be independent to call different interfaces. Whether you do directly or first with a plan to solve, after all, or to separate out, or two sets of systems how to decouple? Isn't that the same as not breaking it down?