Skip to content

Commit

Permalink
add-util
Browse files Browse the repository at this point in the history
  • Loading branch information
uriva committed Nov 10, 2024
1 parent 42925a3 commit 39e4bd1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/taskBouncer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,16 @@ export const bouncerServer = (
resolve(server);
});
});

export const staticFileEndpoint = (
text: string,
contentType: string,
triggerUrl: string,
): Endpoint<never> => ({
predicate: ({ url, method }) => method === "GET" && url === triggerUrl,
bounce: false,
handler: (_, res) => {
res.writeHead(200, { "Content-Type": contentType });
res.end(text);
},
});

0 comments on commit 39e4bd1

Please sign in to comment.