J. Smith J. Smith - 5 months ago 84
PHP Question

API-Centric app in Laravel 5.3

I want to make API (Laravel) and SPA (Vue.js) that uses this API. But I am not sure how to accomplish that.

2 separate projects (1 Laravel project for API and 1 Vue.js project for SPA)
1 Laravel project for both API (routes/api.php) and SPA (routes/web.php)

Which one to choose?


Separated projects are more clean and organized while all in one project is more practical. What I do is create two different repositories ((project-api or project-server or project-backend) and (project-client or project-frontend)) if is a medium-large project and work on them completely separated. Both projects don't know nothing about each other.

Obs: The routing system on frontend is not managed by Laravel as appeared in what you wrote here and SPA (routes/web.php).