UNPKG

@celosiajs/core

Version:

CelosiaJS Core. A framework for REST API based on Express.js

27 lines (26 loc) 982 B
import { Logger } from 'winston'; import { ZodTypeAny, z } from 'zod'; import { CelosiaRequest, CelosiaResponse } from '.'; declare abstract class Controller<T extends Record<string, any> = {}, Request extends CelosiaRequest<any, any, any, any> = CelosiaRequest<any, any, any, any>, Response extends CelosiaResponse<any> = CelosiaResponse<any>> { protected loggingSource: string; protected logger: Logger; constructor(loggingSource: string); abstract index(data: T, request: Request, response: Response): void; /** * Request's body validation. */ get body(): ZodTypeAny; /** * Request's query validation. */ get query(): z.ZodObject<{}, "strip", ZodTypeAny, {}, {}>; /** * Request's params validation. */ get params(): z.ZodObject<{}, "strip", ZodTypeAny, {}, {}>; /** * Request's cookies validation. */ get cookies(): z.ZodObject<{}, "strip", ZodTypeAny, {}, {}>; } export default Controller;