(_req: Request, res: Response, app: App)
| 5 | import type { ReadStreamOptions, FormatProps, DownloadOptions } from '@tinyhttp/res' |
| 6 | |
| 7 | export const renderTemplate = <O>(_req: Request, res: Response, app: App) => ( |
| 8 | file: string, |
| 9 | data?: Record<string, any>, |
| 10 | options?: TemplateEngineOptions<O> |
| 11 | ): Response => { |
| 12 | app.render( |
| 13 | file, |
| 14 | data, |
| 15 | (err: unknown, html: unknown) => { |
| 16 | if (err) throw err |
| 17 | res.send(html) |
| 18 | }, |
| 19 | options |
| 20 | ) |
| 21 | return res |
| 22 | } |
| 23 | |
| 24 | export interface Response<O = any> extends ServerResponse { |
| 25 | header(field: string | Record<string, unknown>, val?: string | any[]): Response |
no test coverage detected