dimanche 26 avril 2020

How to preserve angular routes when using laravel?

I am new to Laravel, so take it easy on me :)

I have had my Angular 7 application on www.somedomain.com for a year now, but I am at the point of needing a backend framework. The hosting company fully supports Laravel 5.*; therefore, I installed it on the server.

I have made Laravel's default route to point to Angular's index.html like so

Route::get('/', function () { 
    View::addExtension('html', 'php');   
    return View::make('index'); 
});

Now the webpage opens my Angular app successfully, but routes are not the same as they used to.

I manage GUI pages via Angular routes and try to use Laravel routes for Http requests.

My problem is that now www.somedomain.com/about view can be accessed from the Angular app by pressing the navigation button, and in the URL it shows https://ift.tt/2SaanmQ correctly. But when I try to directly access that URL, it shows 500 server error because it is being handled by Laravel.

How can I make sure my GUI routes work without Laravel intervention?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2W4NhiN
via IFTTT

Aucun commentaire:

Enregistrer un commentaire