UNPKG

@fal-ai/server-proxy

Version:

The fal.ai server proxy adapter for JavaScript and TypeScript Web frameworks

27 lines (26 loc) 965 B
import { Context } from "hono"; import { ProxyConfig } from "./config"; /** * @deprecated Use `Partial<ProxyConfig>` instead. */ export type FalHonoProxyOptions = Partial<ProxyConfig> & { /** * A function to resolve the API key used by the proxy. * By default, it uses the `FAL_KEY` environment variable. * * @deprecated Use `resolveFalAuth` in `ProxyConfig` instead. */ resolveApiKey?: () => Promise<string | undefined>; }; type RouteHandler = (context: Context) => Promise<Response>; /** * Creates a route handler that proxies requests to the fal API. * * This is a drop-in handler for Hono applications so that the client can be called * directly from the client-side code while keeping API keys safe. * * @param config the proxy configuration options. * @returns a Hono route handler function. */ export declare function createRouteHandler({ resolveApiKey, ...config }?: FalHonoProxyOptions): RouteHandler; export {};