You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-2Lines changed: 22 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,7 +58,7 @@ var P = new Pokedex.Pokedex();
58
58
59
59
**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.
60
60
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.
console.log(response); // resource function accepts singles or arrays of URLs/paths
73
+
});
70
74
```
71
75
72
76
## Configuration
73
77
74
78
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.
76
80
77
81
78
82
```js
@@ -565,6 +569,22 @@ Use **getLanguageByName** to return data about specific pokemon language.
565
569
});
566
570
```
567
571
572
+
### Custom URLs and paths
573
+
574
+
Use **resource** to return data about any URL or path.
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
+
568
588
## Root Endpoints
569
589
570
590
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