Add Swagger API documentation and proxy routing.

Added Swagger as a new service in the docker-compose file for generating the API documentation. The new API documentation is provided via an OpenAPI file located at `public/swagger.json`. Changes in routing were done to handle /api-docs requests and redirect them to the running Swagger UI instance. This will make API easier to understand and debug.
This commit is contained in:
2023-08-23 01:02:56 +06:00
parent 742b0feaf0
commit 9bfd3fef1a
3 changed files with 245 additions and 2 deletions

View File

@@ -8,8 +8,16 @@ server {
root /var/www/html/public;
location / {
# try to serve file directly, fallback to index.php
try_files $uri /index.php$is_args$args;
location /api-docs {
proxy_pass http://swagger:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
location / {
# try to serve file directly, fallback to index.php
try_files $uri /index.php$is_args$args;
}
}
location ~ ^/index\.php(/|$) {