-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwp3.ts
38 lines (35 loc) · 769 Bytes
/
wp3.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import {
chartfn,
staticfn,
// socketiowebsocket,
// messagepipews,
} from "./chartfn.ts";
const luyou = async (req: Request) => {
const url = new URL(req.url);
const pathname = url.pathname;
const pathsz = pathname.split("/");
let path1 = pathsz.shift();
if (pathsz.length != 0) {
path1 = pathsz.shift();
}
switch (path1) {
case "chart": {
return chartfn(req);
}
case "static": {
return staticfn(req, pathname);
}
// case 'socket.io': {
// return socketiowebsocket(req, pathname, url.search);
// }
// case 'message-pipe-ws': {
// return messagepipews(req);
// }
default: {
return new Response("404: Not Found", {
status: 404,
});
}
}
};
Deno.serve(luyou);