How to deploy separate react frontend app and laravel api backend?
have a separate react frontend app and separate laravel api app. In development I connect them and everything works fine by server the react with npm start and laravel artisan: serve separately. But now I want to move to production, please how do I position the react build file and laravel file on the server panel to enable my react access the api route in laravel? Please I really need help with this and looking forward to hearing from you soon. Thanks in advance.
I did the same but it gives me the following error:
"Access to XMLHttpRequest at 'http://premierbackend.webpluspk.com/login' from origin 'http://premier.webpluspk.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource."
Although the application is perfectly working on local WAMP but when I uploaded it online, it gives me the above error.
I truly still need hep on how to place the laravel folder on my cPanel to be able to get the api to api route php and return the expected data or will just upload the folder there and starts working? I have tries this and the API doest not even connect. please help me with this. Lokking forward to hearing from you soon.
For the CORS issue, it is quite simple for me What I did was to go to cors.php
and added my subdomain to 'allowed_origins' and made supports_credentials true
It worked for me