🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@fastnloud/nest-template

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fastnloud/nest-template

Template module for Nest that uses Handlebars to render templates.

latest
Source
npmnpm
Version
2.0.0-rc.0
Version published
Maintainers
1
Created
Source

Description

Template module for Nest that uses Handlebars to render templates.

Installation

$ npm i --save @fastnloud/nest-template

Setup

Import module:

import { TemplateModule } from '@fastnloud/nest-template';
import { Module } from '@nestjs/common';
import * as path from 'path';

@Module({
  imports: [
    TemplateModule.forRoot(path.join(__dirname, 'path', 'to', 'templates')),
  ],
})
export class AppModule {}

A sample template file looks something like this:

<!-- /path/to/templates/dir/template.html.handlebars -->
<!DOCTYPE html>
<html lang="en">
  <body>
    <p>{{ content }}</p>
  </body>
</html>

Usage

import { HandlebarsRenderer } from '@fastnloud/nest-template';
import { Injectable } from '@nestjs/common';

@Injectable()
export class TemplateService {
  constructor(private readonly handlebarsRenderer: HandlebarsRenderer) {}

  async render(): Promise<string> {
    return this.handlebarsRenderer.render(['dir', 'template.html.handlebars'], {
      content: 'hello world',
    });
  }
}

License

nest-template is MIT licensed.

Keywords

nest

FAQs

Package last updated on 26 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts