Ranx99
8 months ago
106
9
Laravel

Consume same API for both web and mobile or not?

Posted 8 months ago by Ranx99

Lets say I am building some large application ( multi-page app ) . And laravel will allow me to make an API and a website on the same application.

Since the website and the API will communicate with the same database, I was wondering if it is better to consume the same API for the website using Vue.js.

So this means I will make single entry point to the database for all the clients ( web , mobile..etc ).

And my plan is to make:

  • ApiControllers ( communicate with the database and return data )
  • WebControllers ( return blade views which have vue.js components to consume the API ) there is no communication with the database in these controllers.

What do you suggest?

Please sign in or create an account to participate in this conversation.