summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-03-16 07:38:31 -0300
committerEuAndreh <eu@euandre.org>2024-03-16 07:38:31 -0300
commitf54df1cb50730add7c254137c7a6452d0ae68226 (patch)
tree37c2d447595b60ded7c2f99fdc7844fe265d3b15
parentsrc/hero.mjs: Move interceptors.contentType() closer to the end of the list (diff)
downloadpapod-f54df1cb50730add7c254137c7a6452d0ae68226.tar.gz
papod-f54df1cb50730add7c254137c7a6452d0ae68226.tar.xz
src/web.mjs: Add "WEBSOCKET" route
-rw-r--r--src/web.mjs15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/web.mjs b/src/web.mjs
index c3651a9..5128a1e 100644
--- a/src/web.mjs
+++ b/src/web.mjs
@@ -1,17 +1,18 @@
import * as u from "./utils.mjs";
import * as hero from "./hero.mjs";
-const listProducts = req => ({ status: 200 });
-const getProduct = req => ({ status: 200, body: "PRODUTO\n" });
-const getSocket = req => ({ status: 200, body: "SOCKET\n" });
-
const name = "papo";
+const newConnection = (req, ws) => {
+ // console.log({ ws, req });
+ // ws.on("error", console.error);
+ // ws.on("message", x => console.log(x.toString()));
+ // ws.send("hello from the server");
+};
+
const routes = [
- [ "GET", "/api/products", listProducts ],
- [ "GET", "/api/products/:id", getProduct ],
- [ "GET", "/api/socket", getSocket ],
+ [ "WEBSOCKET", "/api/socket", newConnection ],
];
export const app = async (socket, pipe) => {