Added index and API docs. Fixed accent color
All checks were successful
Tests / test (3.10) (push) Successful in 9s
Tests / test (3.11) (push) Successful in 8s
Tests / test (3.9) (push) Successful in 8s
Tests / test (3.10) (pull_request) Successful in 9s
Tests / test (3.11) (pull_request) Successful in 9s
Tests / test (3.9) (pull_request) Successful in 9s
All checks were successful
Tests / test (3.10) (push) Successful in 9s
Tests / test (3.11) (push) Successful in 8s
Tests / test (3.9) (push) Successful in 8s
Tests / test (3.10) (pull_request) Successful in 9s
Tests / test (3.11) (pull_request) Successful in 9s
Tests / test (3.9) (pull_request) Successful in 9s
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
# API configuration
|
||||
|
||||
The API server stores all config keys in JSON format in the file `config.json` located under the project's root.
|
||||
On this page you can find all config sections and keys that can be set.
|
||||
|
||||
## database
|
||||
|
||||
Configuration section where all database-related keys are stored.
|
||||
|
||||
### name
|
||||
|
||||
MongoDB database name.
|
||||
|
||||
> Defaults to: `"garbage_api"`
|
||||
|
||||
### host
|
||||
|
||||
MongoDB database host.
|
||||
|
||||
> Defaults to: `"127.0.0.1"`
|
||||
|
||||
### port
|
||||
|
||||
MongoDB database port.
|
||||
|
||||
> Defaults to: `27017`
|
||||
|
||||
### user
|
||||
|
||||
MongoDB database user. Can be string or `null`.
|
||||
|
||||
> Defaults to: `null`
|
||||
|
||||
### password
|
||||
|
||||
MongoDB database password. Can be string or `null`.
|
||||
|
||||
> Defaults to: `null`
|
||||
|
@@ -0,0 +1,125 @@
|
||||
# Installation
|
||||
|
||||
## Requirements
|
||||
|
||||
* [Git](https://git-scm.com)
|
||||
* [MongoDB](https://www.mongodb.com)
|
||||
* [Python 3.8+](https://www.python.org)
|
||||
|
||||
## Installation process
|
||||
|
||||
This manual assumes that your default Python interpreter is called `python` and is Python 3 of the compatible version.
|
||||
|
||||
??? question "What Python interpreter do I use?"
|
||||
|
||||
Python may have multiple instances installed on your machine.
|
||||
On some Linux machines Python 2.7 is the default interpreter called `python`
|
||||
and Python 3 is called `python3` or `python39`.
|
||||
|
||||
You can check which Python version you use using following methods:
|
||||
|
||||
=== "Linux"
|
||||
|
||||
Check which interpreter is used:
|
||||
|
||||
``` sh title="Shell"
|
||||
which python
|
||||
```
|
||||
|
||||
and check the Python version:
|
||||
|
||||
``` sh title="Shell"
|
||||
python -V
|
||||
```
|
||||
|
||||
You can also change default python as follows:
|
||||
|
||||
``` sh title="Shell"
|
||||
sudo update-alternatives --config python
|
||||
```
|
||||
|
||||
=== "Windows"
|
||||
|
||||
Check which interpreters are available:
|
||||
|
||||
``` sh title="Terminal"
|
||||
where python
|
||||
```
|
||||
|
||||
and check the Python version used by default:
|
||||
|
||||
``` sh title="Terminal"
|
||||
python -V
|
||||
```
|
||||
|
||||
You can also change default python using [this guide](https://stackoverflow.com/a/68139696).
|
||||
|
||||
Next, use the interpreter of choice instead of `python` during the installation:
|
||||
|
||||
``` shell title="Shell"
|
||||
/usr/local/bin/python311 -m venv .venv
|
||||
```
|
||||
|
||||
Please note that after the activation of a virtual environment, interpreter you need
|
||||
already has a correct alias and is called `python` regardless of the version.
|
||||
|
||||
### Install Mongo
|
||||
|
||||
Please follow the [official installation manual](https://www.mongodb.com/docs/manual/installation) for that.
|
||||
|
||||
### Clone the source code
|
||||
|
||||
``` sh
|
||||
# Clone the repository
|
||||
git clone https://git.end-play.xyz/GarbageReminder/API.git
|
||||
# Then go the repository's directory
|
||||
cd API
|
||||
```
|
||||
|
||||
### Create virtual environment
|
||||
|
||||
=== "Linux"
|
||||
|
||||
Create virtual environment and activate it:
|
||||
|
||||
``` powershell title="Shell"
|
||||
python -m pip install virtualenv
|
||||
virtualenv .venv
|
||||
.venv/bin/activate
|
||||
```
|
||||
|
||||
=== "Windows"
|
||||
|
||||
Create virtual environment and activate it:
|
||||
|
||||
``` powershell title="Terminal"
|
||||
python -m pip install virtualenv
|
||||
virtualenv .venv
|
||||
.venv\Scripts\Activate.ps1
|
||||
```
|
||||
|
||||
### Install the requirements
|
||||
|
||||
``` sh
|
||||
python -m pip install -r requirements.txt
|
||||
```
|
||||
|
||||
### Configure the API server
|
||||
|
||||
This is a minimal configuration needed for the first start. For more config keys visit the [configuration](api/configuration.md) section in the documentation.
|
||||
|
||||
1. Copy file example to the config file
|
||||
|
||||
``` sh
|
||||
cp config_example.json config.json
|
||||
```
|
||||
|
||||
2. Open `config.json` with your favorite text editor
|
||||
3. Change keys in the `"database"` section to match your MongoDB setup
|
||||
|
||||
### Start the API server
|
||||
|
||||
You can run your API by the following command:
|
||||
`uvicorn main:app --host 127.0.0.1 --port 3000`
|
||||
|
||||
Learn more about available uvicorn arguments using `uvicorn --help`
|
||||
|
Reference in New Issue
Block a user