php - Pros and Cons of using API instead of direct DB Access -


i found myself in several discussions throughout week regarding web application under development , whether should leverage api being created.

here's situation. have php mvc web application mysql db several mobile apps being developed in house. mobile apps we're building rest api. big question why should php web application use rest api? i've expected use of api third party systems need interface database or systems built on different technology. web app not third party system , services in php. if api on different server web app guess considered third party system... has not been decided yet.

to me, seems strange leverage api web app since apis services going limited 50% of functions available in web app leaving me build other 50% unique web app. foresee performance hit web app stepping through service layer rather accessing db directly. on other side see more maintenance having code base web app hitting db , similar functions built api mobile apps.

has found in similar situation , can provide technical pros , cons why should use api or can point me solid case study?

pros:

  • what if 1 day decide move backend app machine? with api, app code won't need change.
  • what if 1 day grow, , need scale 10000 backend apps instead of 1? with api, app code won't need change.
  • what if 1 day decide swap out mysql mongo? with api, app code won't need change.
  • ^ enforced separation of concerns between data access layer (db) , application

cons:

  • more code front when writing app layer
  • more incremental work when need support new app layer feature api doesn't support yet

to me, pros win.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -