From c36bf8e3577da31cf6d575879c7e92d3e9c7e4f1 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 23 Feb 2024 06:05:19 -0300 Subject: Big cleanup - delete all SQLite Node-API code: we'll use the C++ one instead; - implement hero.mjs, with tests! - use ESM all over. --- src/web.mjs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/web.mjs (limited to 'src/web.mjs') 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."); + }); +}; -- cgit v1.2.3