Open jornatf opened 1 year ago
I found this on stackoverflow: https://stackoverflow.com/questions/70534889/vercel-api-conflict-with-laravel-api
I don't try this, but maybe work for you
@jornatf
I found other way to avoid this behavior, but it make an inconsistency between local and server environment:
condition:
inconsistencies:
note:
the only behavior that you can change is:
To avoid this you can create one page that supply both the application access like an form to login/register and one button to reference the api documentation
changes:
RouterServiceProvider
public function boot()
{
$this->configureRateLimiting();
$this->routes(function () {
Route::middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
Route::prefix('/')
->middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
});
}
api.php
Route::prefix('v1')->group(function () {
// all your routes need to be declare here
});
Route::prefix('v2')->group(function () {
// or here to access the v2 of your api
});
// or in both if you want segregate the resources or any other reason
web.php
// i didnt any changes
How to do if I have two route types:
/*
andapi/*
in my Laravel Project ?I have two routes types in my Laravel Project:
/*
for user access dashboard andapi/*
for api access.If I do like this:
The url for
/api/*
is/api/api/*
.How fix it ?
Thx.
Jordan