@isekaimaouyoki-sama/fastify-pug

1.0.2 • Public • Published

@fastify/pug

This is a small wrapper around pug.

Install

npm i @isekaimaouyoki-sama/fastify-pug

Usage

Easy to use require/import this plugin as below

const path = require('path')
const fastify = require('fastify')()

fastify.register(
  require('@isekaimaouyoki-sama/fastify-pug'),
  { 
    // root directory for view
    rootDir: path.join(__dirname, "views")
  }
)

fastify.get("/", async function(request, reply) {
  reply.renderer(
    'home.pug', // path to pug template
    { name: 'toni' } // data to pass into template
  )
})

fastify.listen({ port: 3000 }, err => {
  if (err) throw err
})

Package Sidebar

Install

npm i @isekaimaouyoki-sama/fastify-pug

Version

1.0.2

License

none

Unpacked Size

2.46 kB

Total Files

3

Last publish

Collaborators

  • isekaimaouyoki-sama