UNPKG

uspring

Version:

A very fast Webserver which has interface like springboot

65 lines 2.2 kB
import { SprinkleDocDescription } from './helper/createDocumentation'; import * as Joi from 'joi'; import { MicroResponse } from "./MicroResponse"; import { MicroRequest } from "./MicroRequest"; import { URouter } from "./uRouter"; interface IRESULT { query: any; parameters: unknown; body: any; criteria: unknown; } export interface IRoute { get: any; [key: string]: any; } export declare class RequestMap { isRequestMap: boolean; _route: URouter; _routeDocs: any[]; constructor(route?: URouter); get(pathname: string): RequestValidator; post(pathname: string): RequestValidator; put(pathname: string): RequestValidator; delete(pathname: string): RequestValidator; } export declare class RequestBodyOption { valid: boolean | undefined; schema: Joi.ObjectSchema | undefined; '@sprinkle'?: SprinkleDocDescription; } declare class AuthorizeOption { type?: string; validator: (token: string) => boolean; responseMessage?: string; responseStatus?: string | number; '@sprinkle'?: SprinkleDocDescription; } export declare class RequestValidator { constructor(_route: URouter, _HttpMethod: string, pathname: string); private _route; private _HttpMethod; private _HttpPathName; private _authorizeOption; private _queryString; private _requestBody?; private _requestCriteria?; private _responseBody?; private _prefixError; private _executeAuthorize; private _executeQueryString; private _executePathVariable; private _executeRequestBody; private _executeResponseBody; private _returnResponse; private _executeRequestCriteria; RequestCriteria(schema: Joi.ObjectSchema): RequestValidator; AuthorizeHeader(option: AuthorizeOption): RequestValidator; RequestBody(option?: RequestBodyOption): RequestValidator; RequestHeader(): void; QueryString(queryvar: string | Joi.Schema, joiValidation?: Joi.Schema): RequestValidator; ResponseBody(obj: any): this; Apply(callback: (RESULT: IRESULT, req: MicroRequest, res: MicroResponse, err?: Function) => void): void; } export default RequestMap; //# sourceMappingURL=RequestMapper.d.ts.map