我有一個基本的expressjs應用程序(使用jade),但是我無法渲染基本的Jade文件。當我的請求,我分析的路徑名的URL並使用手柄對象將請求路由如下:在expressjs中渲染jade文件
index.js
var requestHandlers = require('./requestHandlers');
var handle = {};
handle['/'] = requestHandlers.start;
handle['/download'] = requestHandlers.download
requestHandlers.js
function start(res) {
console.log("request handler for start called");
res.render('home', {title: 'express'});
}
function download(res) {
res.render('download', {title: 'download'})
res.end();
}
exports.start = start;
exports.download = download;
家.jade
h1= title
p Welcome to #{title}
我使用Jade作爲我的模板引擎,並已配置服務器在一個單獨的server.js文件。當我請求任一頁面時,標題在我的瀏覽器選項卡上正確顯示,但頁面不顯示,只是繼續加載。奇怪的是,當我取消該頁面顯示的請求時。就好像一切正常,但沒有任何事情告訴過程結束?
我對節點比較陌生,所以請原諒我對以上任何一條的看法。讓我知道是否有任何問題可以解決。