diff --git a/demo/deno/a/index.html b/demo/deno/a/index.html
new file mode 100644
index 0000000..f2ba8f8
--- /dev/null
+++ b/demo/deno/a/index.html
@@ -0,0 +1 @@
+abc
\ No newline at end of file
diff --git a/package.json b/package.json
index e69800c..4d2eee0 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package",
"name": "@kevisual/router",
- "version": "0.0.22",
+ "version": "0.0.23",
"description": "",
"type": "module",
"main": "./dist/router.js",
@@ -21,19 +21,21 @@
"author": "abearxiong",
"license": "MIT",
"devDependencies": {
- "@kevisual/query": "^0.0.25",
+ "@kevisual/local-proxy": "^0.0.3",
+ "@kevisual/query": "^0.0.29",
"@rollup/plugin-alias": "^5.1.1",
- "@rollup/plugin-commonjs": "^28.0.3",
+ "@rollup/plugin-commonjs": "^28.0.6",
"@rollup/plugin-node-resolve": "^16.0.1",
- "@rollup/plugin-typescript": "^12.1.2",
+ "@rollup/plugin-typescript": "^12.1.3",
"@types/lodash-es": "^4.17.12",
- "@types/node": "^22.15.29",
+ "@types/node": "^24.0.3",
+ "@types/send": "^0.17.5",
"@types/ws": "^8.18.1",
"@types/xml2js": "^0.4.14",
"cookie": "^1.0.2",
"lodash-es": "^4.17.21",
"nanoid": "^5.1.5",
- "rollup": "^4.41.1",
+ "rollup": "^4.44.0",
"rollup-plugin-dts": "^6.2.1",
"ts-loader": "^9.5.2",
"ts-node": "^10.9.2",
@@ -41,7 +43,7 @@
"typescript": "^5.8.3",
"ws": "npm:@kevisual/ws",
"xml2js": "^0.6.2",
- "zod": "^3.25.51"
+ "zod": "^3.25.67"
},
"repository": {
"type": "git",
@@ -49,7 +51,8 @@
},
"dependencies": {
"path-to-regexp": "^8.2.0",
- "selfsigned": "^2.4.1"
+ "selfsigned": "^2.4.1",
+ "send": "^1.2.0"
},
"publishConfig": {
"access": "public"
diff --git a/src/app.ts b/src/app.ts
index d221d4d..91e8d9c 100644
--- a/src/app.ts
+++ b/src/app.ts
@@ -105,6 +105,12 @@ export class App {
static handleRequest(req: IncomingMessage, res: ServerResponse) {
return handleServer(req, res);
}
+ onServerRequest(fn: (req: IncomingMessage, res: ServerResponse) => void) {
+ if (!this.server) {
+ throw new Error('Server is not initialized');
+ }
+ this.server.on(fn);
+ }
}
export * from './browser.ts';
diff --git a/src/browser.ts b/src/browser.ts
index 20a4ec2..9f14a88 100644
--- a/src/browser.ts
+++ b/src/browser.ts
@@ -1,6 +1,8 @@
export { Route, QueryRouter, QueryRouterServer } from './route.ts';
-export { Rule, Schema, createSchema } from './validator/index.ts';
+export type { Rule, Schema } from './validator/index.ts';
+
+export { createSchema } from './validator/index.ts';
export type { RouteContext, RouteOpts } from './route.ts';
diff --git a/src/test/static.ts b/src/test/static.ts
new file mode 100644
index 0000000..ba12316
--- /dev/null
+++ b/src/test/static.ts
@@ -0,0 +1,22 @@
+import { proxyRoute, initProxy } from '@kevisual/local-proxy/proxy.ts';
+initProxy({
+ pagesDir: './demo',
+ watch: true,
+});
+import { App } from '../app.ts';
+
+const app = new App();
+app
+ .route({
+ path: 'a',
+ })
+ .define(async (ctx) => {
+ ctx.body = '1';
+ })
+ .addTo(app);
+
+app.listen(2233, () => {
+ console.log('Server is running on http://localhost:2233');
+});
+
+app.onServerRequest(proxyRoute);
diff --git a/src/validator/index.ts b/src/validator/index.ts
index 068a38e..9ba1003 100644
--- a/src/validator/index.ts
+++ b/src/validator/index.ts
@@ -1 +1,2 @@
-export * from './rule.ts';
+export type { Rule, Schema } from './rule.ts';
+export { schemaFormRule, createSchema, createSchemaList } from './rule.ts';