diff options
Diffstat (limited to 'src/web.js')
-rw-r--r-- | src/web.js | 34 |
1 files changed, 34 insertions, 0 deletions
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, +}; |