44 lines
1.3 KiB
PHP
44 lines
1.3 KiB
PHP
<?php
|
|
|
|
use Illuminate\Support\Facades\Route;
|
|
use App\Http\Controllers\FileAccessController;
|
|
use App\Http\Controllers\Api\DocumentationController;
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Web Routes
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Here is where you can register web routes for your application. These
|
|
| routes are loaded by the RouteServiceProvider and all of them will
|
|
| be assigned to the "web" middleware group. Make something great!
|
|
|
|
|
*/
|
|
|
|
Route::get('/', function () {
|
|
return response()->json([
|
|
'name' => 'Project Jahit API',
|
|
'version' => '1.0.0',
|
|
'description' => 'API untuk aplikasi Project Jahit',
|
|
'documentation' => url('/docs')
|
|
]);
|
|
});
|
|
|
|
// Route untuk akses file dari storage
|
|
Route::get('/storage/{path}', [FileAccessController::class, 'serveFile'])
|
|
->where('path', '.*')
|
|
->name('storage.file');
|
|
|
|
// Route khusus untuk file di folder tertentu
|
|
Route::get('/storage/{directory}/{filename}', [FileAccessController::class, 'serveDirectoryFile'])
|
|
->name('storage.directory.file');
|
|
|
|
// Route untuk dokumentasi API
|
|
Route::get('/docs', function () {
|
|
return view('api-docs');
|
|
});
|
|
|
|
Route::get('/docs/{section}', function ($section) {
|
|
return view('api-docs', ['section' => $section]);
|
|
});
|