UNPKG

@quell/server

Version:

Quell is an open-source NPM package providing a light-weight caching layer implementation and cache invalidation for GraphQL responses on both the client- and server-side. Use Quell to prevent redundant client-side API requests and to minimize costly serv

42 lines 1.19 kB
import { Request, Response, NextFunction } from "express"; import { RedisClientType } from "redis"; /** * Interface for endpoints configuration * Keys are endpoint paths, values are either 'local' or API URLs */ interface EndpointConfig { [path: string]: string; } /** * Options for the createQuellRouter function */ interface QuellRouterOptions { endpoints: EndpointConfig; cache: RedisClientType; cacheExpiration?: number; debug?: boolean; headers?: { [apiName: string]: { [headerName: string]: string; }; }; } /** * Creates a router middleware for handling GraphQL requests to multiple endpoints * * @param options Configuration options * @returns Express middleware function */ export declare function createQuellRouter(options: QuellRouterOptions): { (req: Request, res: Response, next: NextFunction): Promise<void | Response<any, Record<string, any>>>; /** * Clears cache for a specific API */ clearApiCache(apiName: string): Promise<number>; /** * Clears all router cache entries */ clearAllCache(): Promise<number>; }; export {}; //# sourceMappingURL=quellRouter.d.ts.map