Set up swagger-ui in the docker compose (port 8000)

This commit is contained in:
Alex Tselegidis 2023-08-01 22:08:55 +02:00
parent 1eadda64c5
commit 007145e213
3 changed files with 24 additions and 13 deletions

View file

@ -82,21 +82,21 @@ header('X-Frame-Options: SAMEORIGIN');
| |
*/ */
header('Access-Control-Allow-Origin: *'); // NOTICE: Change this header to restrict CORS access.
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
{
// May also be using PUT, PATCH, HEAD etc
header('Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD');
}
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
{
header('Access-Control-Allow-Headers: ' . $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']);
}
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'OPTIONS') if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'OPTIONS')
{ {
header('Access-Control-Allow-Origin: *');
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
{
// May also be using PUT, PATCH, HEAD etc
header('Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE, OPTIONS');
}
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
{
header('Access-Control-Allow-Headers: ' . $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']);
}
exit(0); exit(0);
} }

View file

@ -42,3 +42,13 @@ services:
ports: ports:
- '8025:8025' - '8025:8025'
- '1025:1025' - '1025:1025'
swagger-ui:
platform: linux/amd64
image: swaggerapi/swagger-ui
ports:
- "8000:8080"
volumes:
- ./openapi.yml:/usr/share/nginx/html/openapi.yml
environment:
API_URL: openapi.yml

View file

@ -16,6 +16,7 @@ externalDocs:
url: https://easyappointments.org/docs.html url: https://easyappointments.org/docs.html
servers: servers:
- url: https://demo.easyappointments.org/index.php/api/v1/ - url: https://demo.easyappointments.org/index.php/api/v1/
- url: http://localhost/index.php/api/v1/
tags: tags:
- name: admins - name: admins
- name: appointments - name: appointments