Pokénode
A NodeJS wrapper for the Pokéapi.
Install via npm:
npm install --save pokenode
API Reference
Using this wrapper will invoke the same restrictions as hitting the API with REST calls. So there is no authentication, but you are limited to 300 requests per resource per IP address.
We follow the same naming conventions as the official API, so check the documentation for all available features. Here's a quick example. To get Bulbasaur, the equivalent of a call to GET http://pokeapi.co/api/v1/pokemon/1/
, do the following:
var pokeAPI = require('pokenode');
pokeAPI.pokemon(1, function(err, data) {
if(err) {
// handle err
} else {
// have some data about Bulbasaur
}
});
Available functions are pokedex
, pokemon
, type
, move
, ability
, pokemon
, egg
, description
, sprite
, and game
. The function pokedex
takes no parameters, just a callback function.
You do not have to know the index of a type to get the resource. Instead, you may call:
pokeAPI.type('fire', function(err, data) { ...
To get the fire object.
Something else?
The Pokéapi is currently at version 1. In case that ever changes, you can set the version number with:
var pokeAPI = require('pokenode');
pokeAPI.version(2);
Version History
- 0.1.2 Bugfix - return apiCall if resource not defined
- 0.1.1 Basically because I felt like it
- 0.1.0 Initial release