in my case I wanted to get this route as not authenticated user .
RouteServiceProvider has default :
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*
* @return void
*/
protected function mapApiRoutes()
{
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
}
which means you need to add that prefix "api/" to your url, say:
http://yourdomain.com/api/route_url_part
Then put route to api.php , not web.php wich is auth 'middlwared'
(optionally for Android emulators)
if you are trying to do that in, say, android emulator you have to shut down server and start it as:
php artisan serve --host=0.0.0.0
and in java android url instead of localhost put in the ip retrived from prompt window's ipconfig command. Say mine was 192.168.0.106
(IPv4 Address one). Then it will work.