2024-12-17 16:09:18 +08:00
|
|
|
declare module '@gm5/core' {
|
|
|
|
import { Server } from 'http'
|
2025-01-06 10:58:17 +08:00
|
|
|
import Request from '@gm5/request'
|
|
|
|
import Response from '@gm5/response'
|
|
|
|
|
|
|
|
declare type Mountable = string[]
|
2024-12-17 16:09:18 +08:00
|
|
|
|
|
|
|
interface Middleware {
|
|
|
|
(req: Request, res: Response, next: () => void): void
|
|
|
|
}
|
|
|
|
|
|
|
|
interface Installable {
|
|
|
|
name: string
|
2025-01-06 10:58:17 +08:00
|
|
|
install: (args?: Record<string, any>) => any
|
2024-12-17 16:09:18 +08:00
|
|
|
}
|
|
|
|
|
2024-12-19 15:46:07 +08:00
|
|
|
export default class Five {
|
2024-12-17 16:09:18 +08:00
|
|
|
get server(): Server
|
|
|
|
|
2024-12-17 16:11:39 +08:00
|
|
|
set(obj: object): this
|
2024-12-17 16:09:18 +08:00
|
|
|
|
|
|
|
get(key: string): any
|
|
|
|
|
2025-01-06 10:58:17 +08:00
|
|
|
use(middleware: Middleware | Installable | Mountable, args?: Record<string, any>): this
|
2024-12-17 16:09:18 +08:00
|
|
|
|
|
|
|
listen(port?: number, callback?: () => void): this
|
|
|
|
}
|
|
|
|
|
2025-01-06 10:58:17 +08:00
|
|
|
export function mount(dir?: string): Mountable
|
2024-12-18 11:37:15 +08:00
|
|
|
|
2024-12-17 16:09:18 +08:00
|
|
|
export function createApp(conf?: object): Five
|
|
|
|
}
|