> For the complete documentation index, see [llms.txt](https://docs.hackjiji.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hackjiji.org/web-pentesting/api/swagger-installation-on-localhost.md).

# Swagger installation on localhost

```bash
sudo apt update
sudo apt install -y docker.io docker-compose
docker pull docker.swagger.io/swaggerapi/swagger-ui
#Load API definition local .json file. using -v point to the location of this .json file
sudo docker run -p 85:8080 -e  SWAGGER_JSON=/spec/openapi.json -v /h
/home/kali/swagger-docs:/spec docker.swagger.io/swaggerapi/swagger-ui  
#start the swagger UI
http://127.0.0.1:85/

```

If you have multiple json files that you want to load inside the same Swagger instance:

```bash
  sudo docker run --rm -p 85:8080 \
  -e URLS='[
    {"url":"/spec/JSON1.json","name":"Service A"},
    {"url":"/spec/JSON2.json","name":"Service B"}
     ]' \
  -e URLS_PRIMARY_NAME="Service A" \
  -v /home/kali/FolderWhereJsonFilesAreLocated:/usr/share/nginx/html/spec:ro \
  swaggerapi/swagger-ui

# make sure to have necessary rights as ngincs runs as non root user
chmod 755 /home/kali /home/kali/FolderWhereJsonFileAreLocated
chmod 644 /home/kali/FolderWhereJsonFileAreLocated/*.json


```

Create a .json API definition from .yaml file with npx

```bash
npx @redocly/cli bundle openapi.yaml -o bundled.yaml
```
