UNPKG

@spigotmc/microservice

Version:

The library for powering the Microservice API for your Minecraft server.

45 lines (44 loc) 1.42 kB
import express from 'express'; /** * @class Microservice * The Microservice class. */ export default class Microservice { /** * Final variables in the class. */ private app; /** * @constructor Microservice * @param connection The MySQL connection. * @param app The Express application. */ constructor(app: express.Application); /** * @param port The specified port of the service. * @param options The credentials for the database. * @returns A new instance of the Microservice class. */ static host(port: number): Microservice; /** * @returns The Express application on which the * microservice is hosted for perhaps adding * or modifying certain middleware. */ getApplication(): express.Application; /** * @param name The name of the route for e.g. `/api` * @param router The router holding the endpoints. */ setDefiningRoute(name: string, router: express.Router): void; } export declare class Router { private router; constructor(); register(): express.Router; use(name: string, router: Router): void; get(name: string, fn: (query?: any) => any): void; post(name: string, fn: (body?: any) => any): void; put(name: string, fn: (body?: any) => any): void; delete(name: string, fn: (query?: any) => any): void; }