UNPKG

682 BMarkdownView Raw
1# Fastify + Marko
2
3See the [marko-fastify](https://github.com/marko-js-samples/marko-fastify) sample
4project for a fully-working example.
5
6## Installation
7
8```bash
9npm install fastify --save
10npm install point-of-view --save
11npm install marko --save
12```
13
14## Usage
15
16```js
17const fastify = require("fastify")();
18
19fastify.register(require("point-of-view"), {
20 engine: {
21 marko: require("marko")
22 }
23});
24
25fastify.get("/", (req, reply) => {
26 reply.view("/index.marko", {
27 name: "Frank",
28 count: 30,
29 colors: ["red", "green", "blue"]
30 });
31});
32
33fastify.listen(8080, err => {
34 if (err) throw err;
35 console.log(`Server listening on ${fastify.server.address().port}`);
36});
37```