diff options
| -rw-r--r-- | src/web.mjs | 15 |
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) => { |
