diff --git a/demo/backend/app.ts b/demo/backend/app.ts new file mode 100644 index 0000000..7dae7ea --- /dev/null +++ b/demo/backend/app.ts @@ -0,0 +1,24 @@ +import { App } from '@kevisual/router'; + +const app = new App({ + io: true, +}); + +app + .route({ + path: 'test', + key: 'test', + }) + .define(async (ctx) => { + ctx.body = 'test'; + }) + .addTo(app); + +app.listen(4000, () => { + console.log('Server is running at http://localhost:4000'); +}); + +app.io.addListener('subscribe', async ({ data, end, ws }) => { + console.log('A user connected', data); + ws.send('Hello World'); +}); diff --git a/demo/index.html b/demo/index.html index 7ae983c..7bbc348 100644 --- a/demo/index.html +++ b/demo/index.html @@ -8,6 +8,8 @@
- + + +