code_locked
code_locked

Reputation: 125

Laravel: removing "api" prefix from a single route

I need to remove a prefix "api" to only one of the routes in api folder in Laravel project. Is this possible? I know that it works for all the routes by using mapApiRoutes function but this does not work for just one route.

Upvotes: 1

Views: 980

Answers (1)

enbermudas
enbermudas

Reputation: 1615

You could take advantage of the Laravel Sub-Domain Routing in order to create a single route using your application url + the path that you want to create.

Route::domain(config('app.url') . '/path')->group(function () {
    Route::get('path/', function () {
        // your code...
    });
});

Upvotes: 2

Related Questions