abearxiong a6a7e74559 feat: Refactor server implementation to support Bun and Node environments
- Introduced `ServerNode` and `BunServer` classes to handle server logic for Node and Bun respectively.
- Updated `App` class to initialize the appropriate server based on the runtime environment.
- Enhanced `parseBody` function to handle request body parsing for both environments.
- Modified WebSocket handling to support Bun's WebSocket upgrade mechanism.
- Improved error handling and response structure across the server implementation.
- Added support for custom middleware in the server's request handling.
- Refactored server base functionality into `ServerBase` for better code organization.
- Updated type definitions to reflect changes in server options and listener handling.
- Added a new demo for testing the server functionality with various request types.
2025-12-20 05:11:51 +08:00
2025-05-14 21:04:25 +08:00
2025-05-14 21:04:25 +08:00
2025-04-18 01:16:06 +08:00
2025-07-26 20:38:49 +08:00
2025-05-14 21:04:25 +08:00

router

import { App } from '@kevisual/router';

const app = new App();
app.listen(4002);

app
  .route({path:'demo', key: '02})
  .define(async (ctx) => {
    ctx.body = '02';
  })
  .addTo(app);

app
  .route('demo', '03')
  .define(async (ctx) => {
    ctx.body = '03';
  })
  .addTo(app);

兼容服务器

import { App } from '@kevisual/router';

const app = new App();
app.listen(4002);
import { proxyRoute, initProxy } from '@kevisual/local-proxy/proxy.ts';
initProxy({
  pagesDir: './demo',
  watch: true,
});

app.onServerRequest(proxyRoute);
Description
No description provided
Readme 730 KiB
Languages
TypeScript 97.4%
JavaScript 2.6%