87 lines
2.0 KiB
Markdown
87 lines
2.0 KiB
Markdown
# **DeeSee Comics** Superhero Distribution Platform
|
|
|
|
Distribution platform to keep track of employed superheroes as a web service.
|
|
|
|
## Introduction
|
|
|
|
This project is a solution to the AOE Backend Challenge.
|
|
It is a simple REST API that allows to only retrieve superheroes.
|
|
|
|
## Features
|
|
|
|
* Web service that allows to retrieve superheroes.
|
|
* Superheroes can be [filtered by their powers](#api-documentation) and their true identity can be encrypted
|
|
to further provide protection for the ones enrolled in the platform.
|
|
* Encryption is done using a proprietary encryption called the “DeeSee Chiffre”.
|
|
* The superheroes are stored in a [json file](data/heros.json).
|
|
* The application can be configured via [environment variables](#configuration).
|
|
|
|
## Prerequisites
|
|
|
|
* Golang 1.19
|
|
* Make 4.3
|
|
* Bash 5.1
|
|
|
|
## Configuration
|
|
|
|
The application can be configured via environment variables:
|
|
|
|
* `PORT` - the port the application will listen on (default: 8080)
|
|
* `KEY` - the key used for the encryption (default: 5)
|
|
* `DATA_FILE` - the path to the json file containing the superheroes (default: data/superheroes.json)
|
|
|
|
## How to run
|
|
|
|
* `make run` to run the application
|
|
* `make build` to build the application
|
|
* `make clean` to clean the application
|
|
* `make test` to run the tests
|
|
|
|
## API Documentation
|
|
|
|
### GET /superheroes
|
|
|
|
Returns a list of superheroes.
|
|
|
|
#### Parameters
|
|
|
|
* (optional) `superpowers` - a comma separated list of superpowers to filter the superheroes by.
|
|
* (optional) `encrypted` - if set to `true`, the identity will be encrypted.
|
|
|
|
#### Example
|
|
|
|
`GET /superheroes?superpowers=strength,flight&encrypted=true`
|
|
|
|
#### Result
|
|
|
|
```json
|
|
[
|
|
{
|
|
"name": "superman",
|
|
"identity": {
|
|
"firstName": "hqfwp",
|
|
"lastName": "kent"
|
|
},
|
|
"birthday": "1977-04-18",
|
|
"superpowers": [
|
|
"flight",
|
|
"strength",
|
|
"invulnerability"
|
|
]
|
|
},
|
|
{
|
|
"name": "batman",
|
|
"identity": {
|
|
"firstName": "hqfwp",
|
|
"lastName": "kent"
|
|
},
|
|
"birthday": "1977-04-18",
|
|
"superpowers": [
|
|
"flight",
|
|
"strength",
|
|
"invulnerability"
|
|
]
|
|
}
|
|
]
|
|
```
|