From 3bb359bb15448043a0426cf63570f7ed4236960b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 8 Mar 2024 07:23:43 -0300 Subject: src/hero.mjs: Add buildTable() --- src/hero.mjs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/hero.mjs b/src/hero.mjs index 40d3b0d..a51d5c0 100644 --- a/src/hero.mjs +++ b/src/hero.mjs @@ -414,6 +414,13 @@ export const buildRoutes = (routes, globalInterceptors = []) => {} ); +export const buildTable = (routes, globalInterceptors = []) => + u.assocIn( + buildRoutes(routes, globalInterceptors), + ["interceptors"], + globalInterceptors, + ); + export const promisifyServer = (name, serverHandle, socket, pipe) => { let closePipeFn = null; return { @@ -445,7 +452,7 @@ export const buildServer = ({ pipe = `${name}.pipe`, globalInterceptors = defaultInterceptors, }) => { - const table = buildRoutes(routes, globalInterceptors); + const table = buildTable(routes, globalInterceptors); const requestListener = makeRequestListener(table); const server = http.createServer(requestListener); return promisifyServer(name, server, socket, pipe); -- cgit v1.2.3