The simplest way to use miki-template is the render() convenience function. It compiles the template, applies any registered context processors, and returns the HTML — all in one call.
The real power of miki-template comes with setupExpress() — a single function that registers the view engine, configures the views directory, and patches res.render so you can render partials with the view#partial syntax.
constexpress=require('express');constmiki=require('miki-template');constapp=express();miki.setupExpress(app,{extension:'html',views:'./views'});app.get('/',(req,res)=>res.render('home',{user:req.user}));app.listen(3000,()=>console.log('Listening on :3000'));
importexpressfrom'express';importmikifrom'miki-template';constapp=express();miki.setupExpress(app,{extension:'html',views:'./views'});app.get('/',(req,res)=>res.render('home',{user:req.user}));app.listen(3000,()=>console.log('Listening on :3000'));
import{setupExpress}from'miki-template';importexpressfrom'express';constapp=express();// Named import works; default import also works (`import miki from ...`)setupExpress(app,{extension:'html',views:'./views'});