2023-03-07 08:34:28 +00:00
|
|
|
# Http with Swagger/OpenAPI example
|
2018-09-07 20:11:59 +00:00
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
|
|
```clj
|
|
|
|
|
> lein repl
|
|
|
|
|
(start)
|
|
|
|
|
```
|
|
|
|
|
|
2023-03-07 08:34:28 +00:00
|
|
|
- Swagger spec served at <http://localhost:3000/swagger.json>
|
|
|
|
|
- Openapi spec served at <http://localhost:3000/openapi.json>
|
|
|
|
|
- Swagger UI served at <http://localhost:3000/>
|
|
|
|
|
|
2018-09-07 20:11:59 +00:00
|
|
|
To test the endpoints using [httpie](https://httpie.org/):
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
http GET :3000/math/plus x==1 y==20
|
2018-10-21 20:34:25 +00:00
|
|
|
http POST :3000/math/plus x:=1 y:=2
|
2018-09-07 20:11:59 +00:00
|
|
|
|
2018-10-21 20:34:25 +00:00
|
|
|
http GET :3000/async results==1 seed==reitit
|
2018-09-07 20:11:59 +00:00
|
|
|
```
|
|
|
|
|
|
2018-10-21 20:34:25 +00:00
|
|
|
<img src="https://raw.githubusercontent.com/metosin/reitit/master/examples/http-swagger/swagger.png" />
|
2018-09-07 20:11:59 +00:00
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
|
2023-03-07 08:34:28 +00:00
|
|
|
Copyright © 2018-2023 Metosin Oy
|