See the marko-express sample project for a working example.
npm install express --savenpm install marko --save
The built in view engine for express may be asynchronous, but it doesn't support streaming (check out Rediscovering Progressive HTML Rendering to see why this is so important). So instead we'll bypass the view engine.
Marko provides a submodule (
marko/express) to add a
res.marko method to the express response object. This function works much like
res.render, but doesn't impose the restrictions of the express view engine and allows you to take full advantage of Marko's streaming and modular approach to templates.
res.marko you'll automatically have access to
res.locals from within your Marko template and custom tags. These values are added to
EDIT; // Allow Node.js to require and load `.marko` filesvar express = ;var markoExpress = ;var template = ;var app = ;app; //enable res.marko(template, data)app;app;
Helpful? You can thank these awesome people! You can also edit this doc if you see any issues or want to improve it.