codeigniter - Web app and API in same Laravel project? -


i trying figure out best way structure new project embark on.

we have web app , mobile app both fed data api. web app done on installation of codeigniter , api done on separate installation of codeigniter. data, web app makes calls api , handles returned data.

at point looks doing switch laravel web app , thinking might opportunity redo api of our rules have changed , might time off codeigniter altogether.

now question: have read few sources of people building web app , api same laravel project , using routing control mapping of api , web app separately. while seems interesting idea makes me wonder if best practice wonder if heavy api traffic slow down web app , vice versa.

question:

would best practice keep api decoupled in own project or ok in same project?

follow question

to make call web app through api if not decoupled, call api route? better go through classes?

in opinion have 2 choices:

  • build api laravel (response::json everywhere), build web app using js framework angular, or jquery. both web app , mobile app make ajax requests laravel app, , js framework handle displaying it. "not building api + web app in same place" solution. have web app built wherever want, or inside laravel app itself.

    the api easy maintain, , merge web app , mobile app, since both same (unless want them different). also, it's easier extend, since interface remains same across api consumer app.

    this a lot: https://laracasts.com/series/incremental-api-development

  • building api , web app in same place, require separating app in 2: 1 part respond ajax requests , return json , other part answer normal way, returning php views , that..

    this means lot of work , double amount of views, since have build views handled the mobile app , views handled laravel itself. that's lot cover , maintain (and test).

it depends on kind of project you're building. spa?


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -