Skip to content
This repository has been archived by the owner on Sep 29, 2021. It is now read-only.

SerayaEryn/fastify-pug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deprecated. Use point of view instead.

fastify-pug

Build Status Coverage Status NPM version JavaScript Style Guide

A plugin for fastify that adds support for the template engine pug.

Install

npm install fastify-pug

Usage

const fastify = require('fastify');
const fastifyPug = require('fastify-pug');

const app = fastify();
app.register(fastifyPug, {views: 'views'});

app.get('/', (request, reply) => {
	reply.render('template.pug');
});

app.listen(3000, (error) => {
	if (error) throw error
})

API

Options

  • views - the relative path to the folder containing the views.
  • fallbackViews (optional) - a fallback directory for the views.
  • filename (optional) - for handling relative includes. Pass in a function like (view: string) => src/${view}

reply.render(view [, locals])

Renders the template from the relative path view. Allows to pass variables to the template via the locals object.

License

MIT License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published