A Node.js server that works as backend service for true-layer-client. It communicates with PokéAPI and Fun Translations API in order to provide data to the client.
This project was bootstrapped with Express application generator.
- Install Node.js version 14.17.5
- Clone the repository via SSH
git clone git@github.com:HereBeAndre/true-layer-server.git
- Or clone it via HTTPS
git clone https://github.com/HereBeAndre/true-layer-server.git
- Install dependencies
cd true-client-server
npm install
The complete list of dependencies is included in ./package-lock.json
.
- Run the project
npm start
The server listens on port 8080
.
In the project directory, you can run:
Npm Script | Description |
---|---|
npm start |
Runs the app in the development mode via node command. |
Open http://localhost:8080 to view it in the browser. | |
npm run dev |
Runs the app in the development mode via nodemon tool. |
nodemon automatically restarts the node application on files changes. |
|
npm run test |
Runs tests using Jest and SuperTest. |
The tests are written in Jest and the HTTP assertions done using SuperTest.
Test files are created under tests
folder.
- PokéAPI - (https://pokeapi.co/)
- Fun Translations API - (https://funtranslations.com/api/)
Note: Fun Translations API ratelimits the number of public API calls to 60 API calls a day with distribution of 5 calls an hour.
When that limit is exceeded,true-layer-client
will receive the original Pokémon description provided by PokéAPI.
- Retrieve Shakespearean description;
Usage example:
GET http://localhost:8080/pokemon/charmander
Output:
{
"name": "mewtwo",
"description": "'t usually remains motionless to con serveth energy, so yond 't may un leash its full power in hurlyburly."
}
Todo:
- Dockerize the app;
- Implement environment variables management for production, development and testing envs;
- Improve test coverage;
- RegExp to clean Pokémon description might need a review (/n, /f, etc...)
Known bugs:
- Some Pokémon descriptions returned by Fun Translation API have a leading '/';
This project is licensed under the terms of the MIT license.