So I've got a project which is React on the FE and Laravel BE. 99% of all routes are handled through React router, which is fine in the wep.php i've got the following where sends are requests to be handled by React
//routes/web.php
Route::get('/{path?}', [
'uses' => 'App\Http\Controllers\ReactController@show',
'as' => 'react',
'where' => ['path' => '.*'],
]);
The problem comes as we're been asked to implement a wordpress integration which sits inside a sub folder /blogadmin
The problem I'm having is that when I try to hit an endpoint on the wordpress api (using wither graphql or the rest api) e.g. www.mydomain.com/blogadmin/graphql
or www.mydomain.com/blogadmin/wp-json/wp/v2
the routing is passed to laravel and then back to React.
How can I make the word press endpoints accessible?
I've tried adding Route::get('/blogadmin/graphql');
to web.php
as I thought that intercept the request, but no luck!
My Answer:
'HomeController@index', 'as' => 'react',])->where('path', '.*');This allows React to handle all routes except for API routes. However, I also have some API routes that I want to handle on the server side. How can I send these API routes back to the server to be handled by Laravel?
Rate this post
5 of 5 based on 3797 votesComments