Coder Social home page Coder Social logo

hvlxh / node-mcstatus Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mcstatus-io/node-mcstatus

0.0 0.0 0.0 102 KB

The Node.js library for interacting with the mcstatus.io API.

Home Page: https://npmjs.com/package/node-mcstatus

License: MIT License

JavaScript 81.36% TypeScript 18.64%

node-mcstatus's Introduction

node-mcstatus

The official Node.js library for interacting with the mcstatus.io API.

Getting Started

Firstly, you will need to install the library. Open your terminal/command line in your workspace where your package.json file is located, and run the following command.

npm install node-mcstatus

Usage

Java Status

const mcs = require('node-mcstatus');

// ...

const host = 'play.hypixel.net';
const port = 25565;

// The `port` argument is optional and defaults
// to 25565.
mcs.statusJava(host, port)
    .then((result) => {
        // `result` will be the same shape and
        // properties as what is documented on
        // our website.
        // https://mcstatus.io/docs#java-status
    })
    .catch((error) => {
        // If the server is offline, then
        // you will NOT receive an error here.
        // Instead, you will use the `result.online`
        // boolean values in `.then()`.
        // Receiving an error here means that there
        // was an error with the service itself.
    })

Bedrock Status

const mcs = require('node-mcstatus');

// ...

const host = 'pe.mineplex.com';
const port = 19132;

// The `port` argument is optional and defaults
// to 19132.
mcs.statusBedrock(host, port)
    .then((result) => {
        // ...
        // `result` will be the same shape and
        // properties as what is documented on
        // our website.
        // https://mcstatus.io/docs#bedrock-status
    })
    .catch((error) => {
        // If the server is offline, then
        // you will NOT receive an error here.
        // Instead, you will use the `result.online`
        // boolean values in `.then()`.
        // Receiving an error here means that there
        // was an error with the service itself.
    })

License

MIT License

node-mcstatus's People

Contributors

passthemayo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.