export = Router; /** * Attach handler to routes and dispatch a HTTP * message to the right handler * * Handlers will be called with the following arguments: * - request: received HTTP request * - response: HTTP response object * - data: URL query arguments and/or POST data, if any * * @class Router */ declare class Router { defaultHeaders: { "Accept-Encoding": string; "Access-Control-Allow-Headers": string; "Access-Control-Allow-Methods": string; "content-type": string; }; routes: { DELETE: RoutePart; GET: RoutePart; HEAD: RoutePart; PATCH: RoutePart; POST: RoutePart; PUT: RoutePart; }; /** * Attach a handler to a GET HTTP route * * @param {string} path * @param {Function} handler */ get(path: string, handler: Function): void; /** * Attach a handler to a POST HTTP route * * @param {string} path * @param {Function} handler */ post(path: string, handler: Function): void; /** * Attach a handler to a PUT HTTP route * * @param {string} path * @param {Function} handler */ put(path: string, handler: Function): void; /** * Attach a handler to a PATCH HTTP route * * @param {string} path * @param {Function} handler */ patch(path: string, handler: Function): void; /** * Attach a handler to a DELETE HTTP route * * @param {string} path * @param {Function} handler */ delete(path: string, handler: Function): void; /** * Attach a handler to a HEAD HTTP route * * @param {string} path * @param {Function} handler */ head(path: string, handler: Function): void; /** * Route an incoming HTTP message to the right handler * * @param {HttpMessage} message - Parsed HTTP message * @param {function} cb */ route(message: HttpMessage, cb: Function): void; /** * Route HTTP messages using an HTTP method that is not handled by Kuzzle's * API, such as OPTIONS. * @param {HttpMessage} message * @param {function} cb */ routeUnhandledHttpMethod(message: HttpMessage, cb: Function): void; } import RoutePart = require("./routePart");