在 expressjs 中,Dustjs 多个模板不起作用,出现500 错误:找不到模板:模板
我的基本灰尘模板如下(template.dust)
<div class="page">
{+pageHeader}Hello World!{/pageHeader}
<div class="bodyContent">
{+bodyContent/}
</div>
<div class="footer">
{+pageFooter}
<hr>
<a href="/contactUs">Contact Us</a>
{/pageFooter}
</div>
</div>
我试图在我的 home.dust 中调用这个基本模板我收到如下错误
Express
500 Error: Template Not Found: template
at Object.load (C:\office\nodejs-example\express_example\node_modules\application-name\node_modules\dust\lib\dust.js:54:27)
at Chunk.partial (C:\office\nodejs-example\express_example\node_modules\application-name\node_modules\dust\lib\dust.js:407:15)
at body_0 (undefined:1:130)
at Array.0 (C:\office\nodejs-example\express_example\node_modules\application-name\node_modules\dust\lib\dust.js:34:7)
at EventEmitter._tickCallback (node.js:192:40)
“家.尘”
{>"template"/}
{<pageHeader}
{?username}
Welcome {username} <a href="/items">Items</a> | <a href='/logout'> Log Out</a>
{:else}
<form method="POST" action="/signin">
<label>Usename <input type="text" name="username" id="s-user"></label>
<input type="submit" class="submit" value="Login">
</form>
{/username}
{/pageHeader}
路由类方法
exports.home = function(req, res){
res.render('home', {username : req.session.username});
};