From 35f8f325e36c114fd2a8fdc70356342fbc08f3ca Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 17 Mar 2024 14:18:16 -0300 Subject: src/web.mjs: Move the "starting-server" logging into hero when .listen() --- src/web.mjs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src/web.mjs') diff --git a/src/web.mjs b/src/web.mjs index 5128a1e..b13640b 100644 --- a/src/web.mjs +++ b/src/web.mjs @@ -5,7 +5,7 @@ import * as hero from "./hero.mjs"; const name = "papo"; const newConnection = (req, ws) => { - // console.log({ ws, req }); + console.log({ ws, req }); // ws.on("error", console.error); // ws.on("message", x => console.log(x.toString())); // ws.send("hello from the server"); @@ -15,18 +15,10 @@ const routes = [ [ "WEBSOCKET", "/api/socket", newConnection ], ]; -export const app = async (socket, pipe) => { - const server = hero.buildServer({ +export const app = async (socket, pipe) => + await hero.buildServer({ name, routes, socket, pipe, - }); - await server.start(); - hero.log.info({ - type: "starting-server", - name, - socket, - pipe, - }); -}; + }).start(); -- cgit v1.2.3