update: fix docs
This commit is contained in:
@@ -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';
|
||||
|
||||
@@ -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
22
src/test/static.ts
Normal 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);
|
||||
@@ -1 +1,2 @@
|
||||
export * from './rule.ts';
|
||||
export type { Rule, Schema } from './rule.ts';
|
||||
export { schemaFormRule, createSchema, createSchemaList } from './rule.ts';
|
||||
|
||||
Reference in New Issue
Block a user