A simple RESTful API for getting a pokemon with its shakespearean description, it's built on .NET 6 and utilies two RESTful APIs:
- RESTful Pokémon API - https://pokeapi.co/
- Shakespeare translator API - https://funtranslations.com/api/shakespeare
- .NET 6
- Clone the repo.
- Go to this path
ShakespeareanPokemon\ShakespeareanPokemon.Api
and run this commanddotnet run
- The API will be up and running after this locally on port
7060
you can use this path in the browser:https://localhost:7060/swagger/index.html
The API contains one endpoint which recieves a pokemon name, and returns the pokemon name and the shakespearean translation for it. to try the API.
- Go to
https://localhost:7060/swagger/index.html
. - Click on
try it out
- Pass a pokemon name, for example:
wormadam
- Press Execute
- A reponse will be sent back:
{ "result": { "name": "wormadam", "description": "Forms hath't different stats and movepools. During evolution, burmy's current cloak becomes wormadam's form, and can nay longer beest did doth change." }, "success": true, "errors": null }
To run the unit tests for this project you can run it directly from VS or Rider, or you can navigate to this path: ShakespeareanPokemon\ShakespeareanPokemon.Service.UnitTests
and run this command dotnet test
To run the integration tests for this project you can run it directly from VS or Rider, or you can navigate to this path: ShakespeareanPokemon\ShakespeareanPokemon.Service.IntegrationTests
and run this command dotnet test
- Be careful of running it too many times, because the translation API may return
StatusCode: 429, ReasonPhrase: 'Too Many Requests'
, in this case the description will benull
.
To run the API as a containerized image:
- Go to
ShakespeareanPokemon
directory - Run
docker build -t poke-image -f Dockerfile .
- Run
docker run --name poke-image -p 8081:80 -d poke-image
- In the browser go to
http://localhost:8081/swagger/
- xunit 2.4.1
- Moq 4.17.2
- Serilog.AspNetCore 5.0.0
- NSwag.AspNetCore 13.15.10
- Better Logging needs to be done.
- Better Exception handling and error specification.
- Docker image size to be reduced.