import { GenericObject } from "@mongez/reinforcements"; import { GroupedRoutesOptions, ResourceMethod, Route, RouteHandler, RouteOptions, RouteResource } from "./types"; export declare class Router { /** * Routes list */ private routes; /** * Router Instance */ private static instance; /** * Get router instance */ static getInstance(): Router; private constructor(); /** * Add route to routes list */ add(method: Route["method"], path: string | string[], handler: RouteHandler | [GenericObject, string], options?: RouteOptions): this; /** * Add a request that accepts all methods */ any(path: string, handler: RouteHandler | [GenericObject, string], options?: RouteOptions): this; /** * Add get request method */ get(path: string, handler: RouteHandler | [GenericObject, string], options?: RouteOptions): this; /** * Add post request method */ post(path: string | string[], handler: RouteHandler | [GenericObject, string], options?: RouteOptions): this; /** * Add put request method */ put(path: string, handler: RouteHandler | [GenericObject, string], options?: RouteOptions): this; /** * Add delete request method */ delete(path: string | string[], handler: RouteHandler | [GenericObject, string], options?: RouteOptions): this; /** * Add patch request method */ patch(path: string, handler: RouteHandler | [GenericObject, string], options?: RouteOptions): this; /** * Add head request method */ head(path: string, handler: RouteHandler | [GenericObject, string], options?: RouteOptions): this; /** * Add options request method */ options(path: string, handler: RouteHandler | [GenericObject, string], options?: RouteOptions): this; /** * Add full restful resource routes * This method will generate the following routes: * 1. GET /path: list all resources * 2. GET /path/:id: get a single resource * 3. POST /path: create a new resource * 4. PUT /path/:id: update a resource * 5. DELETE /path/:id: delete a resource * 6. PATCH /path/:id: update a resource partially */ restfulResource(path: string, resource: RouteResource, options?: RouteOptions & { only?: ResourceMethod[]; except?: ResourceMethod[]; replace?: Partial> & { bulkDelete?: RouteHandler; }; }): this; /** * Group routes with options */ group(options: GroupedRoutesOptions, callback?: () => void): this; /** * Add prefix to all routes in the given callback */ prefix(prefix: string, callback?: () => void): this; /** * Manage validation system for the given resource */ private manageValidation; /** * Get all routes list */ list(): Route[]; /** * Register routes to the server */ scan(server: any): void; /** * Get the route path for the given route name */ route(name: string, params?: any): string; /** * Handle the given route */ private handleRoute; } export declare const router: Router; //# sourceMappingURL=router.d.ts.map