diff options
-rw-r--r-- | src/web.mjs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/web.mjs b/src/web.mjs index cd875a0..3ca2544 100644 --- a/src/web.mjs +++ b/src/web.mjs @@ -1,18 +1,18 @@ -import * as u from "./utils.mjs"; -import { buildServer, defaultInterceptors } from "./hero.mjs"; - +import * as u from "./utils.mjs"; +import * as hero from "./hero.mjs"; const listProducts = req => ({ status: 200 }); -const getProduct = req => ({ status: 200 }); -const getChat = req => ({ status: 200, body: "something\n" }); +const getProduct = req => ({ status: 200, body: "PRODUTO" }); +const getSocket = req => ({ status: 200, body: "SOCKET" }); + -const server = buildServer([ - [ "GET", "/products", listProducts ], - [ "GET", "/products/:id", getProduct ], - [ "GET", "/chat", getChat ], -], defaultInterceptors); +const server = hero.buildServer("papo", [ + [ "GET", "/api/products", listProducts ], + [ "GET", "/api/products/:id", getProduct ], + [ "GET", "/api/socket", getSocket ], +]); -export const app = async udsPath => { - await server.listen(udsPath); - u.log({ type: "starting-server", udsPath }); +export const app = async path => { + await server.listen(path); + hero.log.info({ type: "starting-server", path }); }; |