pokemon-store is a Restfull API with CRUD operations on pokemons.
Its main functionality is to test the purchase of pokemons through the integration with a credit-card transaction API. The name of the platform is hidden on purpose (avoid spoilers).
This project uses EditorConfig and follows JavaScript Standard Style guidelines to maintain consistent coding styles.
The standardjs needs to be installed as a global dependency.
JavaScript Standard Style
npm install standard --global
Run the command above to install all dependencies:
npm install
The PAGARME_API_KEY env var is required for all environments (test, dev and prod).
export PAGARME_API_KEY=<YOUR_API_KEY>Overview
| Method | Endpoint | Description |
|---|---|---|
| GET | /pokemons | Retrieves a list of all stored pokemons |
| PUT | /pokemons | Create new Pokemons |
| POST | /pokemons/:name | Update a Pokemon |
| DELETE | /pokemons/:name | Delete a Pokemon |
| POST | /orders/pokemon | Buy the given quantity Pokemons if available on stock |
PUT /pokemons
{
"name": "pikachu",
"price": 10,
"stock": 5
}POST /pokemons/pikachu
{
"price": 7,
"stock": 2000
}POST /orders/pokemon
{
"name": "pikachu",
"quantity":3
}On production, the following command should be used to start the app:
NODE_ENV=production node index.jsBut it is not available for now due the dependency of the sqlite.