import Koa from "koa"; import { Controller } from "./controller"; import { RouteContext, Router } from "./router"; import koaCors from "@koa/cors"; import { Plugin } from "./plugin"; import { Logger, LoggerConfig } from "./logger"; export interface Option { /** * Service name */ name?: string; /** * Request path root * @default '' */ base?: string; /** * Host service address * @default 'localhost' */ host?: string; /** * Port number * @default 8000 */ port?: number; /** * Logger configuration */ loggerConfig?: LoggerConfig; /** * Enable HTTPS or not */ https?: boolean; /** * Controller directory for scanning when no controllers are specified * @default './dist/controllers' */ controllerDir?: string; /** * Plugin collection */ plugins?: Plugin[]; /** * Scan controllers when no controllers are specified * @default true */ scanController?: boolean; /** * CORS configuration * @default false */ cors?: koaCors.Options | false; /** * Default root directory for file uploads * @default __dirname */ uploadRootDir?: string; /** * Static service directory */ staticDir?: string; /** Whether the service is connected via a reverse proxy (after enabling, the IP will be resolved to the real IP according to X-Forwarded-For) */ proxy?: boolean; /** Internal prompts (supports multi-language configuration) */ messages?: Record>; /** Default language */ defaultLang?: string; /** Global API timeout in milliseconds */ timeout?: number; /** Validates request bodies to block XSS attacks (blocks script tags, JS URIs, event handlers; allows safe HTML) */ globalRequstBodyValidateRegex?: RegExp | null; } export declare function getCurrentContext(): { app: App; ctx: RouteContext; } | undefined; export declare class App { option: Required