blob: 8eed5b4a3fccb47eb26a008948f58128776ad086 (
plain) (
blame)
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
|
import http from "node:http";
const listProducts = () => {};
const getProduct = () => {};
const routes = {
GET: {
"/products": listProducts,
"/products/:id": getProduct,
},
};
const server = http.createServer((req, res) => {
const { headers ,url, method } = req;
console.log({
headers,
url,
method,
});
res.writeHead(200, {
"Content-Type": "text/plain",
});
res.end("Hello, web!\n");
});
export const app = udsPath => {
server.listen(udsPath, () => {
console.log("I'm web.");
});
};
|