Skip to content

Commit

Permalink
feat: add simple example
Browse files Browse the repository at this point in the history
  • Loading branch information
CosminPerRam committed Oct 30, 2023
1 parent 3a19501 commit 1b0930e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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

Expand Down
11 changes: 11 additions & 0 deletions examples/simple.js
Original file line number Diff line number Diff line change
@@ -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}`)
})

0 comments on commit 1b0930e

Please sign in to comment.