From deecb8a10bf08e8d81cedb4d34ba3b7c40bee7cb Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Tue, 23 Oct 2018 14:55:36 +0300 Subject: [PATCH] README.md: Add example nginx configuration --- README.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1f83c5f..9db1d15 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,26 @@ Test to see if there are any statistics: $ curl 'http://localhost:8000/items?limit=1' ## Deployment -There are example systemd service and timer units in the `contrib` directory. +There are example systemd service and timer units in the `contrib` directory. The API service listens on localhost by default so you will need to expose it publicly using a web server like nginx. + +An example nginx configuration is: + +``` +server { + #... + + location ~ /rest/statistics/?(.*) { + access_log /var/log/nginx/statistics.log; + proxy_pass http://statistics_api/$1$is_args$args; + } +} + +upstream statistics_api { + server 127.0.0.1:5000; +} +``` + +This would expose the API at `/rest/statistics`. ## Using the API The API exposes the following endpoints: