Skip to content

angel-example/templates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

templates

Example of using Mustache templates with Angel.

All you need to do is call a plugin that assigns app.viewGenerator to a new function. mustache is the one we will use here.

Views in your views/ directory will be rendered when res.render is called.

import 'package:angel_common/angel_common.dart';

configureViews(Angel app) async {
  await app.configure(mustache()); // One-line setup
  
  app.get('/', (req, res) => res.render('foo')); // render 'foo.mustache'
  app.get('/bar', (req, res) => res.render('bar', {'baz': 'quux'})); // Render with local data
}

About

Example of using Mustache templates with Angel.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published