Lets say I am building some large application ( multi-page app ) using Laravel. 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 some javaScript framework like Vue.js.
So this means I will make single entry point to the database for all the clients ( web , mobile..etc ) what ever call this API.
And my plan is to make:
- ApiControllers ( communicate with the database and return data )
- WebControllers ( return blade views which will have vue.js components inside to consume the API ). There is no communication with the database in these controllers.
- What do you suggest?
- What will you do in this case?
- Is this a good idea?