Is it possible to create a second Laravel “api route” with a separate API KEY?

后端 未结 2 1946
轻奢々
轻奢々 2021-01-06 06:31

I\'m new to Laravel and I am handed an existing application that is composed of two parts:

1 - An admin backend built on Laravel and uses Vueify

2 - The fron

2条回答
  •  星月不相逢
    2021-01-06 06:36

    You need to define a new route file, firstly add a new entry $this->mapApi2Routes(); in the map() function in app\Providers\RouteServiceProvider.

    Then add a new function in that file, basically copying the mapApiRoutes() function, call it mapApi2Routes(). You can use different middleware etc. for the new file.

    The last step would be adding a new file api2.php in the routes folder.

提交回复
热议问题