mirror of
https://github.com/tribufu/node-gamedig
synced 2026-05-06 15:17:36 +00:00
Add support to CommonJS
This commit is contained in:
parent
0bf6645921
commit
91a38084d2
6 changed files with 678 additions and 4 deletions
13
examples/require.cjs
Normal file
13
examples/require.cjs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
const { GameDig } = require('../dist/index.cjs')
|
||||
// Instead of '../lib/index.js' you would have here 'gamedig'.
|
||||
|
||||
GameDig.query({
|
||||
type: 'minecraft',
|
||||
host: 'mc.hypixel.net',
|
||||
port: 25565, // lets us explicitly specify the query port of this server
|
||||
givenPortOnly: true // the library will attempt multiple ports in order to ensure success, to avoid this pass this option
|
||||
}).then((state) => {
|
||||
console.log(state)
|
||||
}).catch((error) => {
|
||||
console.log(`Server is offline, error: ${error}`)
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue