api路径laravel中的前缀“ api”

问题描述 投票:0回答:1

我只需要为Laravel项目的api文件夹中的路由之一删除前缀“ api”。这可能吗?我知道它通过使用mapApiRoutes函数适用于所有路线,但这并不只适用于一条路线。

laravel
1个回答
1
投票

您可以利用Laravel Sub-Domain Routing来使用您的应用程序URL +您要创建的路径来创建一条路由。

Route::domain(config('app.url') . '/path')->group(function () {
    Route::get('path/', function () {
        // your code...
    });
});
© www.soinside.com 2019 - 2024. All rights reserved.