forked from support-project/knowledge
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add README and update yaml to get HTTP 200 response
- Loading branch information
1 parent
c3ab924
commit c5eb93b
Showing
3 changed files
with
69 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[webapi.yaml](webapi.yaml) is the web API yaml file for [swagger](https://swagger.io/). | ||
|
||
## Quickstart | ||
|
||
By the following steps, you can test APIs by the swagger editor. | ||
In this manual, we run knowledge and swagger editor under `http://localhost` to avoid CORS. | ||
|
||
- deploy knowledge by `launch.sh`. | ||
- assume you can access knowledge by http://172.20.0.1:8080/knowledge | ||
- deploy swagger | ||
- `docker run --rm -d swaggerapi/swagger-editor` | ||
- assume you can access the swagger editor by http://172.17.0.2:8080 | ||
- run nginx reverse proxy | ||
- edit `default.conf` and modify the IP addresses of both containers. | ||
- run nginx reverse proxy | ||
|
||
```bash | ||
docker run --rm -it -p 80:80 -v `pwd`/default.conf:/etc/nginx/conf.d/default.conf | ||
``` | ||
|
||
If everything is OK, you can access knowledge by `http://localhost/knowledge` and swagger editor by `http://localhost`. | ||
|
||
Finally, create and set access token. | ||
|
||
- In knowledge, create an access token. | ||
- Open the swagger editor, and paste webapi.yaml. | ||
- Set the access token from the `Authorize` button in the right tab of the swagger editor. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
server { | ||
listen 80; | ||
server_name localhost; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
} | ||
|
||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
|
||
location ~ ^/knowledge { | ||
proxy_pass http://172.20.0.1:8080; | ||
} | ||
|
||
location ~ ^/swagger { | ||
rewrite /swagger(.*) $1 break; | ||
proxy_pass http://172.17.0.2:8080; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters