Reputation: 11
I want to build a project with 2 separated repositories, for front-end and back-end. As a front end framework I want to use Angular 2+ and as a back end framework Laravel. I do not want to use Laravel's views. Can I somehow expose Angular's dist (build) in Laravel's project? If yes, where do I need to place dist folder (resources, public, elsewhere..)? What do I have to do with routes/web.php file?
I know for a fact that you can do this in Java projects because this is what we are doing at work so there must be a (non-hacky) way.
Upvotes: 0
Views: 401
Reputation: 638
Why don't you try with separate angular for the front end and separate back end in laravel.
Before a couple of months,
I have started working on a project with technologies Angular 5 on the front end and Laravel for the back end.
As far as I know, integrating angular 2+ in any another framework is somewhat difficult except node js.
Angular is having its own way of development and same for laravel.
I would suggest you purchase the separate instance for each. Keep angular on separate and laravel on separate. I am not aware of whether you have used this strategy before or not but you go by creating a rest service in laravel and use those in angular.
In this way, you can create a view in angular and back-end in laravel and play by using rest services.
To know more details about angular 2+ deployment on server, you can visit click here
Upvotes: 0
Reputation: 6432
Can I somehow expose Angular's dist (build) in Laravel's project?
You can but I would recommend that you do not.
What do I have to do with routes/web.php file?
You can delete it if all you are exposing is an API that is consumed by a front-end application.
The two projects should not commingle. Keep each code base in a separate repository and only communicate with the API via HTTP calls from your Angular app.
Upvotes: 2