diff options
author | EuAndreh <eu@euandre.org> | 2024-02-23 06:05:19 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2024-02-23 06:05:21 -0300 |
commit | c36bf8e3577da31cf6d575879c7e92d3e9c7e4f1 (patch) | |
tree | 4fd5414e76490e297c4c770ff35e09149ef3658f /src/web.mjs | |
parent | Remove C code and cleanup repository (diff) | |
download | papod-c36bf8e3577da31cf6d575879c7e92d3e9c7e4f1.tar.gz papod-c36bf8e3577da31cf6d575879c7e92d3e9c7e4f1.tar.xz |
Big cleanup
- delete all SQLite Node-API code: we'll use the C++ one instead;
- implement hero.mjs, with tests!
- use ESM all over.
Diffstat (limited to 'src/web.mjs')
-rw-r--r-- | src/web.mjs | 30 |
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."); + }); +}; |