feat: add QueryRouterServer

This commit is contained in:
2024-10-31 00:45:12 +08:00
parent 158b12d811
commit 52f5f58baf
5 changed files with 106 additions and 21 deletions

View File

@@ -0,0 +1,22 @@
import { QueryRouterServer } from '@kevisual/router';
const router = new QueryRouterServer();
router
.route({
path: 'hello',
key: 'world',
})
.define(async (ctx) => {
ctx.body = 'Hello, world!';
})
.addTo(router);
router
.run({
path: 'hello',
key: 'world',
})
.then((res) => {
console.log(res);
});