35 lines
722 B
TypeScript
35 lines
722 B
TypeScript
// import { App } from '@kevisual/router';
|
|
// @ts-types="https://esm.xiongxiao.me/@kevisual/router/dist/router.d.ts?raw"
|
|
import { App } from '@kevisual/router/mod.ts';
|
|
|
|
console.log('meta', import.meta.url);
|
|
// deno run --allow-all index.ts
|
|
// deno run --config ./deno.json --allow-all index.ts
|
|
console.log('hello world');
|
|
|
|
const app = new App({
|
|
io: true,
|
|
});
|
|
|
|
app
|
|
.route({
|
|
path: 'demo',
|
|
})
|
|
.define(async (ctx) => {
|
|
ctx.body = 'hello world';
|
|
})
|
|
.addTo(app);
|
|
|
|
app.listen(10004, () => {
|
|
console.log('Server is running on http://localhost:10004');
|
|
});
|
|
|
|
app.io.addListener('goo', async ({ data, ws, end }) => {
|
|
console.log('goo', data);
|
|
end({
|
|
code: 200,
|
|
message: 'hello world goo',
|
|
});
|
|
});
|
|
|