https://github.com/jgontrum/insomnia-demo
Demo API to reproduce a bug
https://github.com/jgontrum/insomnia-demo
Last synced: about 1 month ago
JSON representation
Demo API to reproduce a bug
- Host: GitHub
- URL: https://github.com/jgontrum/insomnia-demo
- Owner: jgontrum
- Created: 2017-02-10T17:19:18.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-10T17:20:18.000Z (about 8 years ago)
- Last Synced: 2025-01-27T08:13:43.295Z (3 months ago)
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Insomnia Demo API
Demo API to reproduce a unicode error in the latest version.
The API can be reached under ```http://localhost:50001/api/v1```.
## Requirements
- Python 3.5: [Instructions](https://www.python.org/downloads/)
- virtualenv: [Instructions](https://virtualenv.pypa.io/en/stable/installation/)
## Installation
Run ```make``` for a local setup and then ```env/bin/start_debug``` to start the API in debug mode.
To start the uWSGI, run ```make start```
## Procedure
First, define your REST API in the configuration under ```/config/api.yml```,
then add the Python logic for the *operationId* under /insomnia_demo_api/api## SwaggerUI
Go to [here](http://localhost:50001/api/v1/ui) to view the brilliant SwaggerUI documentation of your API.
## Healthcheck
Configure a health check under /api/v1/health (GET).
The check should return 200 if everything is fine, 424 if a depending service is not working or 503 if the API does not work correctly.
Additionally, a JSON is returned containing the fields 'health', 'dependencies' and 'message'. The first one defines the color ('green', 'yellow', 'red') that
correspond to the status codes. The second one is the name of the depending services that cannot be reached and 'message'
can hold a string defining the cause of a problem.## Logstash
By default, this project sends request logs and other (e.g. error logs) to different logstash UDP ports.
Configure the logstash input like this:
```
input {
udp {
codec => json {}
type => "insomnia_demo_api"
port => 1700
}
udp {
codec => json {}
type => "insomnia_demo_api_uwsgi"
port => 1701
}
tcp {
codec => json {}
type => "insomnia_demo_api_logs"
port => 1702
}
}filter {
if [type] == "insomnia_demo_api" {
json {
source => "message"
}
mutate {
remove_field => [ 'message' ]
}
}
}
```## Resources
### Connexion
[Documentation](https://connexion.readthedocs.io/en/latest/)
[Github](https://github.com/zalando/connexion)### Swagger
[API.yml Editor](http://editor.swagger.io/#/)