Answer the question
In order to leave comments, you need to log in
Should the client adapt to the API, or the API to the client?
Example: Development of a web application.
Who depends on whom - front-end on the API, or API on the front-end? That is, what is being developed first?
And if in the future it will be necessary to make a copy of this application, but on a different platform, for example, Android, how is it more correct in this case? Will Android need to write its own API?
Answer the question
In order to leave comments, you need to log in
function getEventStatus(eventId, cb) {
// ...
request.onsuccess = function(e) {
eventStatus = e.target.result.eventStatus;
cb(eventStatus);
}
}
getEventStatus(request.eventId, (eventStatus) => {
sendResponse({res: eventStatus});
});
function getEventStatus(eventId, e) {
return new Promise((resolve) => {
// ...
request.onsuccess = function(e) {
eventStatus = e.target.result.eventStatus;
resolve(eventStatus);
}
});
}
getEventStatus(request.eventId).then((eventStatus) => {
sendResponse({res: eventStatus});
});
Both depend on the architect and are developed in parallel.
The backend should take into account all clients, so that each client is comfortable working with it,
but so that it can work with all types of clients ...
That is, you all need to adapt to common sense :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question