QueryHost
Esc

Documentation menu

Introduction

Getting started

Install QueryHost and make a typed game-server query from Node.js.

Package status

QueryHost 1.7.0

The current release supports 42 named game profiles plus generic A2S through one reviewed package-root contract.

View QueryHost on GitHub

Before you start

Node.js
24 or newer
npm
12
Runtime
Server-side DNS, UDP, TCP, and HTTP

Install from npm

Install the exact current version with Node.js 24 or newer. Applications can relax the version range after choosing their own update policy.

Terminalshell
npm install queryhost@1.7.0

Make a query

The literal rust game ID connects result.data to the RustData 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);
}

Continue with the docs