/* |-------------------------------------------------------------------------- | API Routes |-------------------------------------------------------------------------- | | Here is where you can register API routes for your application. These | routes are loaded by the RouteServiceProvider within a group which | is assigned the "api" middleware group. Enjoy building your API! | */
Route::middleware('auth:api')->get('/user', function (Request $request) { return$request->user(); });
/** * Define the "api" routes for the application. * * These routes are typically stateless. * * @return void */ protectedfunctionmapApiRoutes() { Route::prefix('api') //前缀 ->middleware('api') //中间件 ->namespace($this->namespace) //命名空间 ->group(base_path('routes/api.php'));