update
This commit is contained in:
28
src/test/nocodb.ts
Normal file
28
src/test/nocodb.ts
Normal 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');
|
||||
});
|
||||
Reference in New Issue
Block a user