This package has been deprecated

Author message:

This package has moved to: @toisu/handlebars

toisu-handlebars

2.2.0 • Public • Published

toisu-handlebars

Greenkeeper badge

toisu-handlebars is a handlebars wrapper for the TOISU! server micro-framework.

install

To install toisu-handlebars into your project, use:

npm install --save toisu-handlebars

usage

const http = require('http');
const Toisu = require('toisu');
const toisuHandlebars = require('toisu-handlebars');
const dbModule = require('./a-bd-module');
 
const template = `
  <!doctype html>
  <html>
  <head><title>Hello, world!</title></head>
  <body>{{bodyContent}}</body>
  </html>
`;
 
const app = new Toisu();
 
// Put some template data on the context.
app.use(async function () {
  const bodyContent = await dbModule.get();
 
  this.set('templateData', {bodyContent});
});
 
// toisu handlebars compiles the template and returns a middleware function.
app.use(toisuHandlebars(template));
 
http.createServer(app.requestHandler).listen(3000);

Package Sidebar

Install

npm i toisu-handlebars

Weekly Downloads

0

Version

2.2.0

License

MIT

Unpacked Size

3.43 kB

Total Files

4

Last publish

Collaborators

  • qubyte