MCSRVSTAT Simple Javascript Wrapper
I do not own MCSRVSTAT, this is simply a wrapper for their API :)
Easily fetch the status of a Minecraft server (Java or Bedrock) all from Node!
You can utilize the following methods below.
If something is missing from these responses that are returned from MCSRVSTAT's API and you'd like to see them supported, create an issue!
Fetch the status of a Minecraft Java server
const serverInfo = await fetchJavaServer('hostname.example.com');
console.log(serverInfo);
// { online: true, version: 'Requires MC 1.8 / 1.19', players: { online: 5, max: 20 }, connection: { ip: 'xxx.xxx.xxx.xxx', hostname: 'hostname.example.com' } }
Fetch the status of a Minecraft Bedrock server
const serverInfo = await fetchBedrockServer('hostname.example.com');
console.log(serverInfo);
// { online: true, version: 'x.xx.xx', players: { online: 5, max: 20 }, connection: { ip: 'xxx.xxx.xxx.xxx', hostname: 'hostname.example.com' } }
Generates a link to the servers icon
let url = await mcsrvstat.fetchIcon('hostname.example.com');
console.log(url)
// 'https://api.mcsrvstat.us/icon/hostname.example.com'
Returns the status of a Minecraft Java server using HTTP status code conventions.
200
is expected for Online and 404
is expected for Offline.
const httpCode = await mcsrvstat.javaHttpCode('hostname.example.com');
console.log(httpCode);
// 200/404
Returns the status of a Minecraft Bedrock server using HTTP status code conventions.
200
is expected for Online and 404
is expected for Offline.
const httpCode = await mcsrvstat.javaHttpCode('hostname.example.com');
console.log(httpCode);
// 200/404