@pulzar/core
Version:
Next-generation Node.js framework for ultra-fast web applications with zero-reflection DI, GraphQL, WebSockets, events, and edge runtime support
68 lines • 1.73 kB
TypeScript
import { Request, Response } from "express";
import { OpenAPIGenerator } from "./generator";
export interface ServeOptions {
path?: string;
title?: string;
description?: string;
version?: string;
contact?: {
name?: string;
email?: string;
url?: string;
};
license?: {
name: string;
url?: string;
};
servers?: Array<{
url: string;
description?: string;
}>;
security?: Array<Record<string, string[]>>;
theme?: "light" | "dark";
customCss?: string;
customJs?: string;
}
export declare class OpenAPIServer {
private generator;
private options;
constructor(generator: OpenAPIGenerator, options?: ServeOptions);
/**
* Serve OpenAPI JSON specification
*/
serveSpec(req: Request, res: Response): void;
/**
* Serve OpenAPI YAML specification
*/
serveSpecYaml(req: Request, res: Response): void;
/**
* Serve Swagger UI
*/
serveUI(req: Request, res: Response): void;
/**
* Generate Swagger UI HTML
*/
private generateSwaggerUI;
/**
* Convert JSON to YAML (simplified implementation)
*/
private jsonToYaml;
/**
* Stringify a value for YAML
*/
private stringifyValue;
/**
* Get middleware for Express
*/
getMiddleware(): (req: Request, res: Response, next: any) => void;
/**
* Get routes for Express Router
*/
getRoutes(): {
[x: string]: {
get: (req: Request, res: Response) => void;
};
};
}
export declare function createOpenAPIServer(generator: OpenAPIGenerator, options?: ServeOptions): OpenAPIServer;
//# sourceMappingURL=serve.d.ts.map