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 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.
- The application can be configured via environment variables.
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 runto run the applicationmake buildto build the applicationmake cleanto clean the applicationmake testto run the tests
API Documentation
Get a list of superheroes
GET /superheroes
Parameters
- (optional)
superpowers- a comma separated list of superpowers to filter the superheroes by. - (optional)
encrypted- if set totrue, the identity will be encrypted.
Example
GET /superheroes?superpowers=strength,flight&encrypted=true
Result
[
{
"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"
]
}
]
Store superhero data
PUT /superheroes
{"name":"supermans","identity":{"firstName":"Kent","lastName":"Clark"},"superpowers":["flight","strength","invulnerability"],"birthday":"1977-04-18"}
Result
{
"message": "Superhero stored successfully.",
"status": "success"
}
Description
Languages
Go
96.6%
Makefile
3.4%