From e912b1945c0544f60a5f118f86742d9a7b1b66b7 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 11 Nov 2023 06:10:57 -0300 Subject: src/{ircd,web}.js: Init stub servers --- src/web.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/web.js (limited to 'src/web.js') diff --git a/src/web.js b/src/web.js new file mode 100644 index 0000000..bfa1807 --- /dev/null +++ b/src/web.js @@ -0,0 +1,34 @@ +const http = require("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"); +}); + +const app = udsPath => { + server.listen(udsPath, () => { + console.log("I'm web."); + }); +}; + +module.exports = { + app, +}; -- cgit v1.2.3