hapi-directory-view
Serve up an entire directory of templates in hapi
Use
var Hapi = ;var Jade = ;var options = url: '/' //URL to serve at index: 'home' //Optional filename to serve as index / base of url views: engines: jade: Jade isCached: false path: './views' //This path is read and served routeConfigs: myPage: handler: view: context: title: 'some string' ; var server = 3000; serverpack;
This is a hapi plugin, the config takes three parameters:
url
is the url to serve the templates from, defaults to/
index
is an optional template name to serve at the base of theurl
views
is a view config for this plugin. The path given will be the directory that this module walks through to serve each template file it finds in it, provided the extension of that file matches one found in theengines
parameter insideviews
routeConfigs
is an object indexed by template name that will be mixed in w/ the route config for that template's route (w/routeConfigs
having priority).