test
This commit is contained in:
parent
a54ba4d823
commit
b9386de0b1
46
deno-router3/deno.lock
generated
46
deno-router3/deno.lock
generated
@ -1,10 +1,56 @@
|
||||
{
|
||||
"version": "4",
|
||||
"specifiers": {
|
||||
"jsr:@std/cli@^1.0.16": "1.0.16",
|
||||
"jsr:@std/encoding@^1.0.9": "1.0.9",
|
||||
"jsr:@std/fmt@^1.0.6": "1.0.6",
|
||||
"jsr:@std/html@^1.0.3": "1.0.3",
|
||||
"jsr:@std/http@*": "1.0.14",
|
||||
"jsr:@std/media-types@^1.1.0": "1.1.0",
|
||||
"jsr:@std/net@^1.0.4": "1.0.4",
|
||||
"jsr:@std/path@^1.0.8": "1.0.8",
|
||||
"jsr:@std/streams@^1.0.9": "1.0.9",
|
||||
"jsr:@std/webgpu@*": "0.224.8",
|
||||
"npm:@types/node@*": "22.12.0"
|
||||
},
|
||||
"jsr": {
|
||||
"@std/cli@1.0.16": {
|
||||
"integrity": "02df293099c35b9e97d8ca05f57f54bd1ee08134f25d19a4756b3924695f4b00"
|
||||
},
|
||||
"@std/encoding@1.0.9": {
|
||||
"integrity": "025b8f18eb1749bc30d1353bf48b77d1eb5e35610220fa226f5a046b9240c5d7"
|
||||
},
|
||||
"@std/fmt@1.0.6": {
|
||||
"integrity": "a2c56a69a2369876ddb3ad6a500bb6501b5bad47bb3ea16bfb0c18974d2661fc"
|
||||
},
|
||||
"@std/html@1.0.3": {
|
||||
"integrity": "7a0ac35e050431fb49d44e61c8b8aac1ebd55937e0dc9ec6409aa4bab39a7988"
|
||||
},
|
||||
"@std/http@1.0.14": {
|
||||
"integrity": "bfc4329d975dff2abd8170e83e37deb454fbc678fec3fdd2ef5b03d92768a4ef",
|
||||
"dependencies": [
|
||||
"jsr:@std/cli",
|
||||
"jsr:@std/encoding",
|
||||
"jsr:@std/fmt",
|
||||
"jsr:@std/html",
|
||||
"jsr:@std/media-types",
|
||||
"jsr:@std/net",
|
||||
"jsr:@std/path",
|
||||
"jsr:@std/streams"
|
||||
]
|
||||
},
|
||||
"@std/media-types@1.1.0": {
|
||||
"integrity": "c9d093f0c05c3512932b330e3cc1fe1d627b301db33a4c2c2185c02471d6eaa4"
|
||||
},
|
||||
"@std/net@1.0.4": {
|
||||
"integrity": "2f403b455ebbccf83d8a027d29c5a9e3a2452fea39bb2da7f2c04af09c8bc852"
|
||||
},
|
||||
"@std/path@1.0.8": {
|
||||
"integrity": "548fa456bb6a04d3c1a1e7477986b6cffbce95102d0bb447c67c4ee70e0364be"
|
||||
},
|
||||
"@std/streams@1.0.9": {
|
||||
"integrity": "a9d26b1988cdd7aa7b1f4b51e1c36c1557f3f252880fa6cc5b9f37078b1a5035"
|
||||
},
|
||||
"@std/webgpu@0.224.8": {
|
||||
"integrity": "47c6bab2671dc7c36cb2505167cbf856bde1028be554f7be6463b30f51e4f8a3"
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
import { createServer } from 'node:http';
|
||||
import fs from 'node:fs';
|
||||
import * as fs from 'node:fs';
|
||||
|
||||
// import * as http from "jsr:@std/http";
|
||||
|
||||
const server = createServer((req, res) => {
|
||||
res.end('Hello World');
|
||||
res?.end('Hello World');
|
||||
});
|
||||
|
||||
const socketPath = '/tmp/http-listen.sock';
|
||||
@ -10,18 +12,23 @@ if (fs.existsSync(socketPath)) {
|
||||
fs.unlinkSync(socketPath);
|
||||
}
|
||||
|
||||
server.listen(
|
||||
{
|
||||
path: socketPath,
|
||||
transport: 'unix', // 指定传输方式为 Unix 套接字
|
||||
port: 10004,
|
||||
},
|
||||
() => {
|
||||
server.listen({ path: socketPath }, () => {
|
||||
console.log('Server is running on. \ncurl --unix-socket /tmp/http-listen.sock http://localhost/api/router?path=demo');
|
||||
throw new Error('test');
|
||||
// throw new Error('test');
|
||||
});
|
||||
console.log(server);
|
||||
console.log(Object.keys(server));
|
||||
server.on('error', (err) => {
|
||||
console.log(err);
|
||||
});
|
||||
console.log(server.address());
|
||||
const req = '';
|
||||
const res = {
|
||||
end: (v: string) => {
|
||||
console.log('end', v);
|
||||
},
|
||||
);
|
||||
|
||||
};
|
||||
server.emit('request', req, res);
|
||||
// Deno.serve(
|
||||
// {
|
||||
// path: socketPath,
|
||||
|
Loading…
x
Reference in New Issue
Block a user