This commit is contained in:
2025-12-06 18:48:46 +08:00
parent d614cf12d1
commit fe7863fbb8
9 changed files with 316 additions and 45 deletions

28
src/test/nocodb.ts Normal file
View File

@@ -0,0 +1,28 @@
import { SimpleRouter, HttpChain } from "@kevisual/router/simple";
import http from "http";
const server = http.createServer();
const router = new SimpleRouter();
router.all('/', async (req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('NocoDB Test Server is running');
});
router.all("/api/router", async (req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain' });
const params = req.url ? new URL(req.url, 'http://localhost').searchParams : null;
console.log('Router API called with params:', params?.toString());
const body = await router.getBody(req);
console.log('Request body:', body);
res.end('Upload API is ready');
});
const httpChain = new HttpChain({ simpleRouter: router });
httpChain.setServer(server)
httpChain.parse()
httpChain.listen({
port: 4000,
host: '0.0.0.0',
}, () => {
console.log('NocoDB test server is running on http://localhost:4000');
});