summaryrefslogtreecommitdiff
path: root/src/web.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'src/web.mjs')
-rw-r--r--src/web.mjs30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/web.mjs b/src/web.mjs
new file mode 100644
index 0000000..8eed5b4
--- /dev/null
+++ b/src/web.mjs
@@ -0,0 +1,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.");
+ });
+};