About project in Vue in a specific folder consuming Laravel data via RESTfull API

0
Is it possible / good practice to create a Vue project in a separate Laravel folder so that all authentication and data consumption is done via the RESTfull Laravel API?

/Raiz
    /Front <- Arquivos Vue
    /Back <- Arquivos Laravel

I have already read in the Laravel documentation that within the resources folder there is an example of Vue implementation. But the fact is that I would like to use the vue template webpack and all its features.

    
asked by anonymous 13.09.2018 / 17:40

1 answer

2

Good afternoon!

Yes, it is possible.

In the Laravel routes / api.php file you can define the routes and their respective functions.

That's enough of your Vue project to request those URLs you've set to consume and manipulate the data.

To access the routes defined in the api.php file it is necessary to add "api /" before the route name.

For example, if the following route has been defined:

Route::get('foo', function () {
    return 'Hello World';
}); 

The URL to access it would be: localhost/api/foo .

    
13.09.2018 / 18:14