I am trying to use domain()
instead of prefix()
for my API's endpoint. Im not able to reach this endpoint
ENV
API_DOMAIN=api.rest-api.test
RoutServiceProvider.php
Route::domain(env('API_DOMAIN'))
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
API.php
Route::get('/person', function(){
$person = [
'first-name' => 'Bob',
'last-name' => 'Tables'
];
return $person;
});
Postman Error
Error: getaddrinfo ENOTFOUND api.rest-api.test
EDIT : I neglected to mention that this worked properly with the default prefix()
option.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…