update: fix docs

This commit is contained in:
熊潇 2025-06-20 16:20:56 +08:00
parent d2ebb5f488
commit 187900ad55
6 changed files with 45 additions and 10 deletions

1
demo/deno/a/index.html Normal file
View File

@ -0,0 +1 @@
abc

View File

@ -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"

View File

@ -105,6 +105,12 @@ export class App<T = {}, U = AppReqRes> {
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';

View File

@ -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';

22
src/test/static.ts Normal file
View File

@ -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);

View File

@ -1 +1,2 @@
export * from './rule.ts';
export type { Rule, Schema } from './rule.ts';
export { schemaFormRule, createSchema, createSchemaList } from './rule.ts';