summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-03-08 07:23:43 -0300
committerEuAndreh <eu@euandre.org>2024-03-08 07:23:43 -0300
commit3bb359bb15448043a0426cf63570f7ed4236960b (patch)
tree13ba57760961449d757ad7df54c2c59a3794bb6f /src
parentsrc/hero.mjs: server.listen() -> server.start(); server.close() -> server.stop() (diff)
downloadpapod-3bb359bb15448043a0426cf63570f7ed4236960b.tar.gz
papod-3bb359bb15448043a0426cf63570f7ed4236960b.tar.xz
src/hero.mjs: Add buildTable()
Diffstat (limited to 'src')
-rw-r--r--src/hero.mjs9
1 files changed, 8 insertions, 1 deletions
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);