# **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 a list of superheroes ```http request GET /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 ```http request 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" ] } ] ``` ### Store superhero data ```http request PUT /superheroes {"name":"supermans","identity":{"firstName":"Kent","lastName":"Clark"},"superpowers":["flight","strength","invulnerability"],"birthday":"1977-04-18"} ``` #### Result ```json { "message": "Superhero stored successfully.", "status": "success" } ```