Change to subdomain routing

This commit is contained in:
R
2022-09-17 01:09:01 +07:00
parent 0ea1c2dea4
commit 9fffde25b0
2 changed files with 21 additions and 20 deletions

View File

@@ -61,8 +61,7 @@ class RouteServiceProvider extends ServiceProvider
*/ */
protected function mapApiRoutes() protected function mapApiRoutes()
{ {
Route::prefix('api') Route::middleware('api')
->middleware('api')
->namespace($this->moduleNamespace) ->namespace($this->moduleNamespace)
->group(module_path('Linksehat', '/Routes/api.php')); ->group(module_path('Linksehat', '/Routes/api.php'));
} }

View File

@@ -15,23 +15,25 @@ use Modules\Linksehat\Http\Controllers\Api\HospitalController;
| is assigned the "api" middleware group. Enjoy building your API! | is assigned the "api" middleware group. Enjoy building your API!
| |
*/ */
Route::domain('api.linksehat.dev')->prefix('linksehat')->group(function () {
Route::post('otp-request', [AuthController::class, 'otpRequest']); Route::post('otp-request', [AuthController::class, 'otpRequest']);
Route::post('mock-otp', [AuthController::class, 'mockOtp']); Route::post('mock-otp', [AuthController::class, 'mockOtp']);
Route::post('login', [AuthController::class, 'login']); Route::post('login', [AuthController::class, 'login']);
Route::post('register', [AuthController::class, 'register']); Route::post('register', [AuthController::class, 'register']);
Route::get('articles', [ArticleController::class, 'index']); // Route::get('articles', [ArticleController::class, 'index']);
Route::get('articles/id', [ArticleController::class, 'show']); // Route::get('articles/id', [ArticleController::class, 'show']);
Route::get('hospitals', [HospitalController::class, 'index']); Route::get('hospitals', [HospitalController::class, 'index']);
Route::get('hospitals/{id}', [HospitalController::class, 'show']); Route::get('hospitals/{id}', [HospitalController::class, 'show']);
Route::get('doctors/online', [DoctorController::class, 'index']); Route::get('doctors/online', [DoctorController::class, 'index']);
Route::get('doctors', [DoctorController::class, 'index']); Route::get('doctors', [DoctorController::class, 'index']);
Route::get('doctors/{id}', [DoctorController::class, 'show']); Route::get('doctors/{id}', [DoctorController::class, 'show']);
Route::get('doctors/{id}/schedule', [DoctorController::class, 'schedule']); Route::get('doctors/{id}/schedule', [DoctorController::class, 'schedule']);
Route::middleware('auth:api')->get('/linksehat', function (Request $request) { Route::middleware('auth:api')->get('/linksehat', function (Request $request) {
return $request->user(); return $request->user();
});
}); });