php - Should an API contain front datas? -


our tech team works on 1 website main product of our company. have office website used work on product efficiently.

we'd make website better , create middle earth between office , front product since share same datas. want create mobile application that'll share (again) same datas.

we thought making api containing of business model.

now what's consistent , effective use ? should api contain crud models ? logic isn't shared across domains... should contain every end logic possible ? wouldn't dead code on 1 side or 1 ?

should contain front end code ? mean generated html templates it'll fill data ? problem got last question : page a. need model x display basic properties. api sends it. need use method 1 on x display data. can't because don't have access x methods now.

an api should deliver data need work with. also, should contain business logic, except things sorting or this.

so have webpage example, works data. complete layout, design whatsoever within webpages project. data need required through api though.

of course, if need same data quite often, may think caching such results. done provider-wise (api) or consumer-wise (example webpage).

the point of working data is, consumer gathers information needs send request provider (api) , gets information delivered, consumer needs show them or decide next.

all heavy work lays down on api site, else api wouldn't make sense, since goal provide 1 single point, contains logic. you shouldn't repeat yourself.


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -