@midwayjs/koa
Version:
Midway Web Framework for KOA
53 lines (49 loc) • 1.15 kB
TypeScript
import {
Application,
IMidwayKoaConfigurationOptions,
Context as KoaContext,
BodyParserOptions,
State,
} from './dist';
import { CookieSetOptions, Cookies } from '@midwayjs/cookies';
import '@midwayjs/session';
export * from './dist/index';
declare module '@midwayjs/core' {
interface MidwayConfig {
keys?: string | string[];
koa?: IMidwayKoaConfigurationOptions;
cookies?: CookieSetOptions;
cookiesExtra?: {
defaultGetOptions?: {
sign?: boolean;
};
};
/**
* onerror middleware options
*/
onerror?: {
text?: (err: Error, ctx: KoaContext) => void;
json?: (err: Error, ctx: KoaContext) => void;
html?: (err: Error, ctx: KoaContext) => void;
redirect?: string;
accepts?: (...args) => any;
};
bodyParser?: BodyParserOptions;
siteFile?: {
enable?: boolean;
favicon?: undefined | string | Buffer;
};
}
}
declare module 'koa' {
interface Request {
body?: unknown;
rawBody: string;
}
interface Context {
cookies: Cookies;
app: Application;
forward: (url: string) => void;
state: State;
}
}