MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / makeSelfHostApiHandler

Function makeSelfHostApiHandler

apps/host-selfhost/src/app.ts:179–195  ·  view source on GitHub ↗
(
  options: MakeSelfHostAppOptions = {},
)

Source from the content-addressed store, hash-verified

177// uses for Workers). The self-host server (serve.ts) binds `AppLayer` to a
178// listening socket instead. We wrap `dispose` to also close the DB / MCP store.
179export const makeSelfHostApiHandler = async (
180 options: MakeSelfHostAppOptions = {},
181): Promise<SelfHostApiHandler> => {
182 const { toWebHandler, betterAuth, closeDb } = await makeSelfHostApp(options);
183 const web = toWebHandler();
184 return {
185 handler: async (request) => {
186 const location = await oauthCallbackSignInRedirectLocation(request, betterAuth.auth);
187 if (location) return new Response(null, { status: 302, headers: { location } });
188 return web.handler(request);
189 },
190 dispose: async () => {
191 await web.dispose();
192 await closeDb();
193 },
194 };
195};

Calls 3

makeSelfHostAppFunction · 0.85
disposeMethod · 0.80

Tested by

no test coverage detected