This commit is contained in:
2025-12-01 10:54:24 +08:00
parent d06b384ca4
commit e00a6c7418

18
src/test/listen-ip.ts Normal file
View File

@@ -0,0 +1,18 @@
// import { Server } from 'node:http';
import { Server } from '../server/server.ts'
const server = new Server({
path: '/',
handle: async (data, ctx) => {
console.log('ctx', ctx.req.url)
console.log('Received data:', data);
ctx.res.writeHead(200, { 'Content-Type': 'application/json' });
return JSON.stringify({ code: 200, message: 'Success', data });
}
});
server.listen(51015, '0.0.0.0', () => {
console.log('Server is listening on http://localhost:3000');
});