-
-
Save dnohr/de935d01dc22d5cf45dee34979dda3a1 to your computer and use it in GitHub Desktop.
Fastify + POV example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Uptime</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% include header %> | |
<h1>Superman</h1> | |
<% include footer %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const fastify = require('fastify')(); | |
fastify.register(require('point-of-view'), { | |
engine: { | |
ejs: require('ejs') | |
}, | |
templates: 'views' | |
}); | |
fastify.get('/', (req, reply) => { | |
reply.view('main.ejs', {}); | |
}); | |
fastify.listen(3000, (err) => { | |
if (err) throw err | |
console.log(`Server up: ${fastify.server.address().port}`); | |
}); |
delvedor
commented
Nov 6, 2017
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment