From 769752d07cf7d9df8cbda83ed6a0358534d6d73f Mon Sep 17 00:00:00 2001 From: Sayan Bhattacharyya Date: Sun, 27 Oct 2024 21:39:50 +0530 Subject: [PATCH] docs: update readme --- Makefile | 3 +++ README.md | 43 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d9a2285..f36562b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,7 @@ env: + uv venv + +prod: uv sync --no-dev dev: diff --git a/README.md b/README.md index e9cdbd5..bd2ac7e 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ NervaAPI is a RESTful API server for the Nerva blockchain. It provides a simple - Git - Python >= 3.8 - MongoDB database +- [make](https://www.gnu.org/software/make/) (optional) ## Installation @@ -38,11 +39,27 @@ NervaAPI is a RESTful API server for the Nerva blockchain. It provides a simple cd NervaAPI ``` -4. Install dependencies +4. Create a virtual environment + + ```shell + uv venv + ``` + or if you have `make` installed + + ```shell + make env + ``` + +5. Install dependencies ```shell uv sync --no-dev ``` + or if you have `make` installed + + ```shell + make prod + ``` ## Configuration @@ -50,10 +67,34 @@ Copy the [`config.example.py`](config.example.py) file to `config.py` and update ## Running +### Development + ```shell uv run launcher.py ``` +or if you have `make` installed + +```shell +make +``` + +### Production + +```shell +source .venv/bin/activate +hypercorn --bind 0.0.0.0:8000 launcher:app +``` + +or if you want to enable SSL support + +```shell +source .venv/bin/activate +hypercorn --certfile cert.pem --keyfile key.pem --bind 0.0.0.0:8000 launcher:app +``` + +The API server will be running at `http://localhost:8000`. The certificate and key files are required for SSL support. + ## License [GNU General Public License v3.0](LICENSE)