-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapi.php
43 lines (31 loc) · 1.53 KB
/
api.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
use Illuminate\Support\Facades\Route;
$apiRoutes = function () {
Route::group(['middleware' => 'auth:api'], function () {
/**
* Users API
*/
// All responses (except index) will include the user's full history of groups
//Return current user
Route::get('/me', [App\Http\Controllers\Api\UserApiController::class, 'me']);
//Return all users (index), teachers only
Route::get('/users', [App\Http\Controllers\Api\UserApiController::class, 'index']);
//Find a user by id(ab01 / D123456), teachers only
Route::get('/users/{user}', [App\Http\Controllers\Api\UserApiController::class, 'user']);
/**
* Groups API
*/
// All responses (except index) will include the group's members (only for teachers)
//Return all currently active groups (index)
Route::get('/groups', [App\Http\Controllers\Api\GroupApiController::class, 'index'])->name('api.groups');
//Find group by name (eg.: RIO4-AMO1A). Returns only currently active groups!
Route::get('/groups/find/{name}', [App\Http\Controllers\Api\GroupApiController::class, 'find'])->name('api.groups.find');
//Find group by id
Route::get('/groups/{group}', [App\Http\Controllers\Api\GroupApiController::class, 'group'])->name('api.groups.group');
});
};
if (env('APP_ENV') === 'local' || env('APP_ENV') === 'testing') {
Route::group(['prefix' => '/api'], $apiRoutes);
} else {
Route::group(['domain' => 'api.curio.codes'], $apiRoutes);
}