pokedex-promise
v1.0.4
Published
A small library used to get information about specific pokemon.
Downloads
4
Maintainers
Readme
pokedex-promise
The v1 api has been depreciated. Check out pokedex-promise-v2.
An easy way to use pokeapi with promises in node.js
Install
You can install with npm!
npm install pokedex-promise
Setup
Import to your project.
var Pokedex = require('pokedex-promise');
Usage
Initialize the constructor.
var P = new Pokedex();
Use getPokemonList to return the names and resource_uri for all pokemon.
router.get('/', function(req, res) {
P.getPokemonList
.then(function(response) {
res.json(response);
})
.catch(function(error) {
console.log('There was an ERROR: ', error);
});
});
Use getPokemonById to return data on a specific pokemon. Note: the ID for Pokémon is special. Use the National pokédex number as the ID to return the desired resource.
router.get('/', function(req, res) {
P.getPokemonById(5)
.then(function(response) {
res.json(response);
})
.catch(function(error) {
console.log('There was an ERROR: ', error);
});
});
Use getTypeById to return data about a specific type. A Type resource represents a single Pokémon type.
router.get('/', function(req, res) {
P.getTypeById(5)
.then(function(response) {
res.json(response);
})
.catch(function(error) {
console.log('There was an ERROR: ', error);
});
});
Use getMoveById to return data about a specific move. A Move resource represents a single move.
router.get('/', function(req, res) {
P.getMoveById(5)
.then(function(response) {
res.json(response);
})
.catch(function(error) {
console.log('There was an ERROR: ', error);
});
});
Use getAbilityById to return data about a specific ability. An Ability resource represents a single Pokémon ability.
router.get('/', function(req, res) {
P.getAbilityById(5)
.then(function(response) {
res.json(response);
})
.catch(function(error) {
console.log('There was an ERROR: ', error);
});
});
Use getEggById to return data about a specific egg group. An egg group resource represents a single Pokémon egg group.
router.get('/', function(req, res) {
P.getEggById(5)
.then(function(response) {
res.json(response);
})
.catch(function(error) {
console.log('There was an ERROR: ', error);
});
});
Use getDescriptionById to return data about a specific Pokémon description. A description resource represents a single Pokémon description.
router.get('/', function(req, res) {
P.getDescriptionById(5)
.then(function(response) {
res.json(response);
})
.catch(function(error) {
console.log('There was an ERROR: ', error);
});
});
Use getSpriteById to return data about a specific Pokémon sprite. A sprite resource represents a single Pokémon sprite.
router.get('/', function(req, res) {
P.getSpriteById(5)
.then(function(response) {
res.json(response);
})
.catch(function(error) {
console.log('There was an ERROR: ', error);
});
});
Want to contribute?
Submit a pull request!