-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: init route for the bot API with config and env #1
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
$routePrefix = env('BLOG_API_ROUTE_PREFIX', 'api'); | ||
|
||
return [ | ||
'defaults' => [ | ||
/* Set route prefix for the blog API */ | ||
'route_prefix' => $routePrefix, | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Route; | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Blog API Routes | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here is where you can register bot routes for your application. These | ||
| routes are loaded by the RouteServiceProvider and all of them will | ||
| be assigned to the "api" middleware group. Enjoy building your API! | ||
| | ||
*/ | ||
|
||
$routePrefix = config('blog-api.defaults.route_prefix'); | ||
|
||
Route::prefix($routePrefix)->name("$routePrefix.")->group(function () { | ||
Route::get('/posts', function () { | ||
return response()->json([ | ||
'message' => 'Hello from the blog API!', | ||
]); | ||
}); | ||
}); |