QueryHost
Documentation menu

Introduction

Getting started

Install the private package artifact and make a typed game-server query from Node.js.

Requirements

  • Node.js 24 or newer
  • npm 12
  • A server-side Node.js runtime with ordinary DNS, UDP, TCP, and HTTP networking

Install from a verified source checkout

Build and verify the library before packing it. The resulting tarball is the same artifact used by the hosted services.

Terminalshell
cd ../query
npm run verify
npm pack --pack-destination ../consumer
cd ../consumer
npm install ./queryhost-0.0.0.tgz

Make a query

The literal rust game ID connects result.data to theRustData type. Always check result.ok before reading success or failure fields.

query.tsTypeScript
import { query } from "queryhost";

const result = await query({
  game: "rust",
  host: "play.example.com",
  port: 28015,
});

if (result.ok) {
  console.log(result.server.name);
  console.log(result.data.tags);
} else {
  console.error(result.error.code);
}

Where to go next