https://github.com/isekaimaou1109/fastify-pug
The minimal package for rendering pug template
https://github.com/isekaimaou1109/fastify-pug
Last synced: 9 days ago
JSON representation
The minimal package for rendering pug template
- Host: GitHub
- URL: https://github.com/isekaimaou1109/fastify-pug
- Owner: isekaimaou1109
- Created: 2024-03-17T19:12:10.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-03-20T19:31:25.000Z (about 1 year ago)
- Last Synced: 2025-04-19T10:25:02.565Z (about 1 month ago)
- Language: JavaScript
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @fastify/pug
This is a small wrapper around [pug](https://pugjs.org/api/getting-started.html).
## Install
```
npm i @isekaimaouyoki-sama/fastify-pug
```## Usage
Easy to use require/import this plugin as below
```js
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
})
```