aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md217
1 files changed, 217 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..0bb5bc9
--- /dev/null
+++ b/README.md
@@ -0,0 +1,217 @@
+# HEROES API
+
+Make your Heroes API
+
+## Installation
+
+### Standar installation
+
+heroeapi require of **python packages** and **MongoDB** for work.
+
+After running your **MongoDB** set configuration:
+
+Write `.env` file:
+
+```sh
+API_DEBUG=False
+DB_NAME=heroes # changeme
+DB_HOST=127.0.0.1
+DB_PORT=27017
+DB_USER=root # changeme
+DB_PASS=example # changeme
+DB_AUTH=admin
+JWT_SECRET_KEY=eo7aiHie4aeth4eteeho7ahC7yeetohsi7a # changeme
+USER_ENABLE_REGISTER=True
+```
+
+```console
+$ git clone https://c.hgit.ga/software/heroeapi.git
+```
+
+```console
+$ virtualenv -p python3 venv
+```
+
+```console
+$ pip install -r requirements.txt
+```
+
+```console
+$ python wsgi.py
+```
+
+### Docker Compose
+
+Set configuration file `.env` on **heroeapi app** and `.db.env` **mongo database**
+
+Write `.env`:
+
+```sh
+# APP
+API_DEBUG=False
+DB_NAME=heroes # changeme
+DB_HOST=127.0.0.1
+DB_PORT=27017
+DB_USER=root
+DB_PASS=example # changeme
+DB_AUTH=admin
+JWT_SECRET_KEY=eo7aiHie4aeth4eteeho7ahC7yeetohsi7a # changeme
+USER_ENABLE_REGISTER=True
+
+# GUNICORN
+GUNICORN_TIMEOUT=30
+GUNICORN_NUM_WORKERS=4
+```
+
+Write `.db.env`:
+
+```sh
+MONGO_INITDB_ROOT_USERNAME=root # changeme
+MONGO_INITDB_ROOT_PASSWORD=example # changeme
+MONGO_INITDB_DATABASE=admin
+```
+
+Write `docker-compose.yml`:
+
+```yaml
+version: '3'
+
+services:
+ app:
+ image: rusian/heroeapi
+ container_name: heroeapi
+ env_file: .env
+ networks:
+ - heroeapi
+ ports:
+ - "5000:5000"
+ tty: true
+ restart: "always"
+
+ mongo:
+ image: mongo:4.4.12-focal
+ container_name: heroeapi_db
+ restart: always
+ command: [--auth]
+ env_file:
+ - .db.env
+ networks:
+ - heroeapi
+ volumes:
+ - ./heroeapi_db:/data/db
+ ports:
+ - "27017:27017"
+
+networks:
+ default:
+ name: heroeapi
+```
+
+```console
+$ docker-compose up -d
+```
+
+### Generate image from build
+
+```console
+$ docker build --tag rusian/heroesapi -f Dockerfile .
+```
+
+## Usage
+
+Check `test` directory for some examples.
+Remember that you must first create the **user** to be able to add a **Hero**
+
+## API References
+
+#### Heroes
+
+| Reference | Method | Purpose |
+|--------------------------------|--------|----------------------------------------------------------------------------|
+| /api/v1/heroes | GET | Returns all information of the character. |
+| /api/v1/heroes/:id | GET | Search by character id. Returns all information of the character. |
+| /api/v1/heroes/:id | POST | Add of information of the character (only Admin) |
+| /api/v1/heroes/:id | DELETE | Delete character by id (only Admin) |
+| /api/v1/heroes/:id | PUT | Update character by id (only Admin) |
+| /api/v1/heroes/:id/powerstats | GET | Returns JSON Array of all powerstats of given character. |
+| /api/v1/heroes/:id/biography | GET | Returns JSON Array of character's biography. |
+| /api/v1/heroes/:id/appearance | GET | Returns JSON Array of character's appearance. |
+| /api/v1/heroes/:id/work | GET | Returns JSON Array of character's work i.e. occupation and operation base. |
+| /api/v1/heroes/:id/connections | GET | Returns JSON Array of character's connections. |
+| /api/v1/heroes/:id/image | GET | Returns image url of the character. |
+| /api/v1/heroes/search/name | GET | Search character by name. Returns character id. |
+
+
+###### /api/v1/heroes/id/powerstats
+
+This API call provides all powerstats for the given character. The powerstats are as follows:
+
+- Intelligence
+- Strength
+- Speed
+- Durability
+- Power
+- Combat
+
+###### /api/v1/heroes/id/biography
+
+This API call gives the biographical stats of the character. They are:
+
+- Full Name
+- Alter Egos
+- Aliases
+- Place of Birth
+- First Appearance
+- Publisher
+- Alignment
+
+###### /api/v1/heroes/id/appearance
+
+This API call provides the appearance of the character. The various statistics are :
+
+- Gender
+- Race
+- Height
+- Weight
+- Eye Color
+- Hair Color
+
+###### /api/v1/heroes/id/work
+
+This API lists the work/occupation of the character. They are:
+
+- Occupation
+- Base of operation
+
+###### /api/v1/heroes/id/connections
+
+This call lists out the connections of the character.
+
+- Group Affiliation
+- Relatives
+
+###### /api/v1/heroes/id/image
+
+This provides the image for the character, if exists.
+
+- image
+
+###### /api/v1/heroes/search/name
+
+This API call helps you in finding the character-id of a character by searching it's name.
+
+#### Users
+
+| Reference | Method | Purpose |
+|---------------------|--------|-----------------------------------------------|
+| /api/v1/users | GET | Returns all information of users (only Admin) |
+| /api/v1/users/:id | GET | Search by character id (only Admin) |
+| /api/v1/users/:id | POST | Add of information of the user (only Admin) |
+| /api/v1/users/:id | DELETE | Delete user by id (only Admin) |
+| /api/v1/users/:id | PUT | Update user by id (only Admin) |
+| /api/v1/auth/signup | POST | Create user |
+| /api/v1/auth/token | POST | Generate Token |
+
+## LICENSE
+
+This work is licensed under the [GNU GPLv3+](LICENSE)