Skip to content

Commit 3467047

Browse files
committed
Updated docs
1 parent 1f73e4e commit 3467047

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@
22
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/)
33
[![Build Status](https://travis-ci.org/fastify/point-of-view.svg?branch=master)](https://travis-ci.org/fastify/point-of-view)
44

5-
Template plugin for Fastify
5+
Templates rendering plugin support for Fastify.
66

7+
`point-of-view` decorates the reply interface with the `view` method for manage view engines that can be used to render templates responses.
8+
9+
Currently supports the following templates engines:
10+
- [`ejs`](http://www.embeddedjs.com/)
11+
- [`pug`](https://pugjs.org/api/getting-started.html)
12+
- [`handlebars`](http://handlebarsjs.com/)
13+
14+
In `production` mode, `point-of-view` will heavily cache the templates file and functions, while in `development` will reload every time the template file and function.
715
## Install
816

917
```
@@ -29,6 +37,17 @@ fastify.listen(3000, err => {
2937
console.log(`server listening on ${fastify.server.address().port}`)
3038
})
3139
```
40+
41+
If you want to set a fixed templates folder, or pass some options to the template engines:
42+
```js
43+
fastify.register(require('point-of-view'), {
44+
engine: {
45+
ejs: require('ejs')
46+
},
47+
templates: '/templates',
48+
options: {}
49+
})
50+
```
3251
## Acknowledgements
3352

3453
This project is kindly sponsored by:

0 commit comments

Comments
 (0)