0.2.0 • Published 8 years ago

relax-express-hogan v0.2.0

Weekly downloads
5
License
Apache-2.0
Repository
github
Last release
8 years ago

npm version Build Status Coverage Status Dependency Status

relax-express-hogan

Connect Hogan.js with Express, with support for Partials.

Why Hogan.js?

Hogan.js is a very straighforward implementation of mustache that keeps logic out of your views.

Usage Example

views/index.html

{{> header}} {{who}}
{{> footer}}

views/header.html

<i>Hey There</i>,

views/footer.html

<footer>See ya</footer>

app.js

import express from 'express'
import expressHogan from 'relax-express-hogan'

const app = express()

app.set('views', __dirname + '/views')
app.set('view engine', 'html')
app.register('html', expressHogan)

app.get('/', (req, res) => {
  res.render('index', {
    who: 'World'
  })
})

app.listen(3000)
% node app.js
% curl http://localhost:3000
<i>Hey There</i>, World
<footer>See ya</footer>