我目前正在使用 laravel 11.x 和 React Inertia。我想为移动应用程序创建受身份验证保护的 api 路由。 Inertia 不提供 api 的 auth 中间件。它使用令牌身份验证。
这种情况下如何设置api中间件和路由。
在 Laravel 11 中,您可以通过以下 artisan 命令创建自己的 api-route..
php artisan install:api
在 Laravel 11 中 api.php 和channels.php 路由文件默认不再存在。
更多信息请参见官方文档。这是链接...
https://laravel.com/docs/11.x/middleware
Laravel 11 的发行说明在以下链接中给出..
https://laravel.com/docs/11.x/releases
N:B :- 您将了解如何使用react-inertia创建auth middlware和api路由来构建项目的各个方面。