8000 GitHub - dbalduini/pokemon-store: 🐭 pokemon-store tests the integration with a credit card transaction API · GitHub
[go: up one dir, main page]

Skip to content

About

🐭 pokemon-store tests the integration with a credit card transaction API

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

pokemon-store

Build Status

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).

Configuration

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

Installation

Run the command above to install all dependencies:

npm install

Environment

The PAGARME_API_KEY env var is required for all environments (test, dev and prod).

export PAGARME_API_KEY=<YOUR_API_KEY>

Routes

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

Payload Examples

PUT /pokemons

{
 "name": "pikachu",
 "price": 10,
 "stock": 5
}

POST /pokemons/pikachu

{
 "price": 7,
 "stock": 2000
}

POST /orders/pokemon

{
  "name": "pikachu",
  "quantity":3
}

Production

On production, the following command should be used to start the app:

NODE_ENV=production node index.js

But it is not available for now due the dependency of the sqlite.


About

🐭 pokemon-store tests the integration with a credit card transaction API

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

0