Archived
1
0
Fork 0

Add HTTP API

Add `-api` mode to start the HTTP API with the following routes:
- /health
- /shops
- /shops/:id
- /products
- /products/:id

Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
Julien Riou 2021-03-25 18:00:29 +01:00
commit 17a88265c6
No known key found for this signature in database
GPG key ID: FF42D23B580C89F7
7 changed files with 200 additions and 3 deletions

View file

@ -122,6 +122,10 @@ Options:
* `include_regex` (optional): include products with a name matching this regexp
* `exclude_regex` (optional): exclude products with a name matching this regexp
* `browser_address` (optional): set headless browser address (ex: `http://127.0.0.1:9222`)
* `api` (optional):
* `address`: listen address for the REST API (ex: `127.0.0.1:8000`)
* `cert_file` (optional): use SSL and use this certificate file
* `key_file` (optional): use SSL and use this key file
## Usage
@ -137,6 +141,12 @@ restockbot -help
docker run -it --name restockbot --rm --link chromium:chromium -v $(pwd):/root/ restockbot:$(cat VERSION) restockbot -help
```
## Execution modes
There are two modes:
* **default**: without special argument, the bot parses websites and manage its own database
* **API**: using the `-api` argument, the bot starts the HTTP API to expose data from the database
## How to contribute
Lint the code with pre-commit: