mirror of
https://github.com/gamedig/node-gamedig.git
synced 2024-11-17 17:25:19 +01:00
feat: add simple example
This commit is contained in:
parent
3a1950133d
commit
1b0930ee75
2 changed files with 13 additions and 5 deletions
|
@ -11,11 +11,7 @@ Support is available on the [GameDig Discord](https://discord.gg/NVCMn3tnxH) (fo
|
|||
See the [GAMES_LIST.md](GAMES_LIST.md) file for the currently supported titles, not yet supported ones and notes about some of them.
|
||||
|
||||
## Usage from Node.js
|
||||
Install...
|
||||
```shell
|
||||
npm install gamedig
|
||||
```
|
||||
... then use!
|
||||
Install using your favorite package manager:`npm install gamedig`, then use!
|
||||
```js
|
||||
import GameDig from 'gamedig';
|
||||
|
||||
|
@ -28,6 +24,7 @@ GameDig.query({
|
|||
console.log("Server is offline");
|
||||
});
|
||||
```
|
||||
Confused on how this works, or you want to see more? Checkout the [examples](/examples) folder!
|
||||
|
||||
## Query Options
|
||||
|
||||
|
|
11
examples/simple.js
Normal file
11
examples/simple.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
import GameDig from '../lib/index.js'
|
||||
// Instead of '../lib/index.js' you would have here 'gamedig'.
|
||||
|
||||
GameDig.query({
|
||||
type: 'minecraft',
|
||||
host: 'mc.hypixel.net'
|
||||
}).then((state) => {
|
||||
console.log(state)
|
||||
}).catch((error) => {
|
||||
console.log(`Server is offline, error: ${error}`)
|
||||
})
|
Loading…
Reference in a new issue