Skip to content

Commit

Permalink
Setup Redoc
Browse files Browse the repository at this point in the history
  • Loading branch information
arifszn committed Sep 1, 2022
1 parent 2747959 commit 71ecaac
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

DISPLAY_SWAGGER_UI=true
DISPLAY_SWAGGER_UI=true
DISPLAY_REDOC=true
1 change: 1 addition & 0 deletions config/pandora.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@

'api_doc' => [
'display_swagger_ui' => (bool) env('DISPLAY_SWAGGER_UI', true),
'display_redoc' => (bool) env('DISPLAY_REDOC', true),
],
];
19 changes: 19 additions & 0 deletions resources/views/openapi-spec/redoc.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="SwaggerUI" />
<title>{{Config::get('app.name')}} - Documentation</title>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/swagger-ui.css" />
<link rel="icon" href={{asset('favicon.ico')}} />
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">
</head>

<body>
<redoc spec-url='{{asset("openapi.yaml")}}'></redoc>
<script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"> </script>
</body>

</html>
File renamed without changes.
14 changes: 13 additions & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,19 @@
}

if (Config::get('pandora.api_doc.display_swagger_ui')) {
Route::get('/documentation', function () {
Route::get('/swagger-ui', function () {
return view('swagger.index');
});
}

if (Config::get('pandora.api_doc.display_swagger_ui')) {
Route::get('/swagger-ui', function () {
return view('openapi-spec.swagger');
});
}

if (Config::get('pandora.api_doc.display_redoc')) {
Route::get('/redoc', function () {
return view('openapi-spec.redoc');
});
}

0 comments on commit 71ecaac

Please sign in to comment.