Skip to content

Commit 084aeb8

Browse files
committed
Readme updated
1 parent fcb538d commit 084aeb8

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ var P = new Pokedex.Pokedex();
5858

5959
**NOTE**: Any function with the designation "ByName" can also be passed an integer ID. However, the functions with the designation "ById" can only be passed an integer ID. Refer to the [pokeapi v2 docs](http://pokeapi.co/docsv2/) to find out more about how the data is structured.
6060

61-
**UPDATE**: You can pass an array to each endpoint, it will retrive data for each array element. If you scroll down, you will find an example.
61+
**UPDATE**: You can pass an array to each function, it will retrive data for each array element. If you scroll down, you will find two examples.
6262

6363
### [Example](http://jsbin.com/jedakor/edit?html,console) requests
6464

@@ -67,12 +67,16 @@ var P = new Pokedex.Pokedex();
6767
.then(function(response) {
6868
console.log(response);
6969
});
70+
P.resource(['/api/v2/pokemon/36', 'api/v2/berry/8', 'https://pokeapi.co/api/v2/ability/9/'])
71+
.then(function(response) {
72+
console.log(response); // resource function accepts singles or arrays of URLs/paths
73+
});
7074
```
7175

7276
## Configuration
7377

7478
Pass an Object to Pokedex() in order to configure it. Available options: `protocol`, `hostName`, `versionPath`, `cache`, `timeout` in ms.
75-
Any option is optional :smile:. If no Object is passed, the Pokedex will be initialized to grab data from pokeapi.co using http with 20 seconds timeout and caching resources.
79+
Any option is optional :smile:. If no Object is passed, the Pokedex will be initialized to grab data from pokeapi.co using http with 20 seconds timeout and caching resources. We recommend to use HTTPS protocol since Pokeapi.co recently enabled HTTP redirects.
7680

7781

7882
```js
@@ -565,6 +569,22 @@ Use **getLanguageByName** to return data about specific pokemon language.
565569
});
566570
```
567571

572+
### Custom URLs and paths
573+
574+
Use **resource** to return data about any URL or path.
575+
576+
```js
577+
P.resource(['/api/v2/pokemon/36', 'api/v2/berry/8', 'https://pokeapi.co/api/v2/ability/9/'])
578+
.then(function(response) {
579+
console.log(response); // resource function accepts singles or arrays of URLs/paths
580+
});
581+
582+
P.resource('api/v2/berry/5')
583+
.then(function(response) {
584+
console.log(response);
585+
});
586+
```
587+
568588
## Root Endpoints
569589

570590
For each root endpoint we provide a method to get all the items contained by that endpoint. By default the method will return every item in the endpoint. If you want you can configure its offset and limit.

0 commit comments

Comments
 (0)