Update d.ts (#15)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Yusuke Wada · committed by GitHub · parent b6d9eb3 · Browse files · 1 file·+45 added−27 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+45 added−27 removed
- other:+45 added−27 removed
Provenance
- Commit
b8512b0- Tree
4de3ee5- Author
Yusuke Wada <yusuke@kamawada.com>- Committer
GitHub <noreply@github.com>- Parent
b6d9eb3
1 file changed+45 added−27 removed
modified:src/hono.d.ts+45 added-27 removed
1234123465678910111213141516171819202122232425262728293031123233343536373839202122232425264041282942434432454647484950513435363738395253545556575859606142434462464763646566declare class FetchEvent {}declare class Request {}declare class Response {}declare class Context {}declare interface FetchEvent {}declare interface Request {}declare interface Response {}
declare class Node {}type Result = { handler: any params: {}}
declare class Node { method: string handler: any children: Node[] middlewares: any[]
insert(method: string, path: string, handler: any): Node search(method: string, path: string): Result}
declare class Context { req: Request res: Response newResponse(params: {}): Response}
type Handler = (c: Context, next: () => void) => Response | void
declare class Router { tempPath: string node: Node
add(method: string, path: string, handlers: any[]): Node add(method: string, path: string, handler: Handler): Node match(method: string, path: string): Node}
export class Hono { router: Router middlewareRouters: Router[]
getRouter(): Router addRoute(method: string, args: any[]): Hono matchRoute(method: string, path: string): Node createContext(req: Request, res: Response): Context dispatch(req: Request, res: Response): Response handleEvent(event: FetchEvent): Response fire(): void use(path: string, middleware: Handler): void
notFound(): Response
route(path: string): Hono fire(): void
use(path: string, middleware: any): void all(path: string, handler: Handler): Hono get(path: string, handler: Handler): Hono post(path: string, handler: Handler): Hono put(path: string, handler: Handler): Hono head(path: string, handler: Handler): Hono delete(path: string, handler: Handler): Hono
all(path: string, handler: any): Hono get(path: string, handler: any): Hono post(path: string, handler: any): Hono put(path: string, handler: any): Hono head(path: string, handler: any): Hono delete(path: string, handler: any): Hono notFound(): Response
getRouter(): Router addRoute(method: string, args: any[]): Hono matchRoute(method: string, path: string): Promise<Node> createContext(req: Request, res: Response): Promise<Context> dispatch(req: Request, res: Response): Promise<Response> handleEvent(event: FetchEvent): Promise<Response>}
// XXXdeclare interface BuiltinMiddleware {}
export class Middleware { static defaultFilter: BuiltinMiddleware static poweredBy: BuiltinMiddleware static defaultFilter: Handler // Add builtin middlewares static poweredBy: Handler}