mirror of
https://github.com/maxswa/osrs-json-hiscores.git
synced 2025-10-15 10:19:04 +00:00
Add CORS disclaimer
This commit is contained in:
13
README.md
13
README.md
@@ -15,6 +15,14 @@ Additional functions are provided that screen-scrape the OSRS leaderboards and r
|
|||||||
|
|
||||||
`osrs-json-hiscores` has TypeScript support, with full definitions for all functions and custom data types.
|
`osrs-json-hiscores` has TypeScript support, with full definitions for all functions and custom data types.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Disclaimer
|
||||||
|
|
||||||
|
Jagex does not provide `Access-Control-Allow-Origin` headers in their responses. This means that [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) will block all browser requests to their hiscores API. In order to get around this, osrs-json-hiscores should be installed on the server side and exposed to the front end via a simple API. Here is an example of this in use: [codesandbox.io/s/osrs-json-hiscores-demo](https://codesandbox.io/s/osrs-json-hiscores-demo-qz656)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
With npm:
|
With npm:
|
||||||
@@ -41,7 +49,7 @@ Once you import it you can call the functions asynchronously:
|
|||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
hiscores
|
hiscores
|
||||||
.getStats('Lynx Titan', 'full')
|
.getStats('Lynx Titan')
|
||||||
.then(res => console.log(res))
|
.then(res => console.log(res))
|
||||||
.catch(err => console.error(err));
|
.catch(err => console.error(err));
|
||||||
```
|
```
|
||||||
@@ -57,7 +65,8 @@ const stats = await hiscores.getStats('Lynx Titan');
|
|||||||
const topPage = await getSkillPage('overall');
|
const topPage = await getSkillPage('overall');
|
||||||
```
|
```
|
||||||
|
|
||||||
`getStats` will return a `full` player object with game mode by default, but it will also accept any of the following game modes:
|
`getStats` will return a full player object with gamemode.
|
||||||
|
`getStatsByGameMode` will return a stats object and accepts a gamemode parameter:
|
||||||
|
|
||||||
| Game mode | Param |
|
| Game mode | Param |
|
||||||
| ---------------- | :----: |
|
| ---------------- | :----: |
|
||||||
|
Reference in New Issue
Block a user