@mcansh/remix-fastify
Version:
Fastify server request handler for Remix and React Router
17 lines (16 loc) • 827 B
TypeScript
import { AppLoadContext, UNSAFE_MiddlewareEnabled, unstable_InitialContext } from "react-router";
import { FastifyReply, FastifyRequest } from "fastify";
//#region src/middleware.d.ts
type MaybePromise<T> = T | Promise<T>;
/**
* A function that returns the value to use as `context` in route `loader` and
* `action` functions.
*
* You can think of this as an escape hatch that allows you to pass
* environment/platform-specific values through to your loader/action, such as
* values that are generated by Express middleware like `req.session`.
*/
type GetLoadContextFunction = (req: FastifyRequest, res: FastifyReply) => UNSAFE_MiddlewareEnabled extends true ? MaybePromise<unstable_InitialContext> : MaybePromise<AppLoadContext>;
//#endregion
export { GetLoadContextFunction };
//# sourceMappingURL=middleware.d.ts.map