@foal/core
Version:
Full-featured Node.js framework, with no complexity
27 lines (26 loc) • 1.11 kB
TypeScript
import { HttpResponseOK } from '../http';
/**
* Util function to render a template. Minimalist built-in template engine for FoalTS.
*
* renderToString('Hello {{ name }}!', { name: 'Mary' }) returns 'Hello Mary!'
*
* @export
* @param {string} template - The template.
* @param {any} locals - The variables required by the template.
* @returns {string} The rendered template.
*/
export declare function renderToString(template: string, locals: any): string;
/**
* Render a template in a new HttpResponseOK object.
*
* The template engine is specified using the configuration key `settings.templateEngine`.
*
* @export
* @param {string} templatePath - The path of the template.
* @param {object} locals - The variables used to render the template.
* @param {string} [dirname] - The directory name where the templated is located.
* The passed value is usually `__dirname`. The function then joins `dirname` and
* `templatePath` together.
* @returns {Promise<HttpResponseOK>}
*/
export declare function render(templatePath: string, locals?: object, dirname?: string): Promise<HttpResponseOK>;