npm i -S koa-posthtml
'use strict'
import { join } from 'path'
import koa from 'koa'
import posthtml from 'koa-posthtml'
const app = koa()
// Setup View Engine
posthtml(app, {
ext: 'html',
root: join(__dirname, 'views'),
options: {/* Options */},
plugins: [/* Plugins */]
writeResp: true
})
app.use(function * () {
// Render index.html
yield this.render('index')
})
app.on('error', (err) => console.error('=> Server error', err))
app.listen(3000, () => console.log('=> Server started'))
Michael Ciniawsky |
See PostHTML Guidelines and contribution guide.