Something went wrong. Try again.
Dedicated SSR (Server-side-rendered) Astro native Headless CMS, build from the ground up for the Astro community and by Astro community memb github.com/withstudiocms/studiocms
Something went wrong. Try again.
123456789101112131415161718import { HttpApiToAstroRoute } from '../src/astro/HttpApi';import { EffectHttpHandlerToHttpApi, webHandlerToEffectHttpHandler } from '../src/webHandler';
// Example of converting a standard web handler to an Effect API and then to an Astro API route handlerconst mockWebHandler = async (request: Request) => { console.log('Received request:', request); return new Response('Hello from mock web handler!', { status: 200 });};
// Convert the mock web handler to an Effect API handlerconst EffectHttpHandler = webHandlerToEffectHttpHandler(mockWebHandler);
// Convert the Effect API handler to an EffectApiHandler that can be used with HttpApiBuilderconst EffectHttpApiHandler = EffectHttpHandlerToHttpApi('*', EffectHttpHandler);
// Finally, convert the Effect API to an Astro API route handlerconst _AstroAPIRoute = HttpApiToAstroRoute(EffectHttpApiHandler);