This commit is contained in:
熊潇 2025-05-25 00:05:20 +08:00
parent e31b19f931
commit d2a03fc959
2 changed files with 6 additions and 1 deletions

View File

@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package",
"name": "@kevisual/router",
"version": "0.0.21-beta",
"version": "0.0.21",
"description": "",
"type": "module",
"main": "./dist/router.js",

View File

@ -2,6 +2,8 @@ import { QueryRouter, Route, RouteContext, RouteOpts } from './route.ts';
import { Server, ServerOpts, HandleCtx } from './server/server.ts';
import { WsServer } from './server/ws-server.ts';
import { CustomError } from './result/error.ts';
import { handleServer } from './server/handle-server.ts';
import { IncomingMessage, ServerResponse } from 'http';
type RouterHandle = (msg: { path: string; [key: string]: any }) => { code: string; data?: any; message?: string; [key: string]: any };
type AppOptions<T = {}> = {
@ -100,6 +102,9 @@ export class App<T = {}, U = AppReqRes> {
throw(...args: any[]) {
throw new CustomError(...args);
}
static handleRequest(req: IncomingMessage, res: ServerResponse) {
return handleServer(req, res);
}
}
export * from './browser.ts';