在快速应用程序中使用Docpad的渲染引擎

我正在尝试使用docpad来处理快速应用程序中的呈现,但是当试图访问/contact请求只是看起来无限期地挂起。

这是我的申请:

 var express = require('express'); var http = require('http'); var app = express(); var cons = require('consolidate'); var server = http.createServer(app).listen(process.env.PORT || 9778); app.use(app.router); // Add DocPad to our Application var docpadInstanceConfiguration = { // Give it our express application and http server serverExpress: app, serverHttp: server, // Tell it not to load the standard middlewares (as we handled that above) middlewareStandard: false }; var docpadInstance = require('docpad').createInstance(docpadInstanceConfiguration, function(err){ if (err) return console.log(err.stack); // Tell DocPad to perform a generation, extend our server with its routes, and watch for changes docpadInstance.action('generate server watch', docpadInstanceConfiguration, function(err){ if (err) return console.log(err.stack); }); }); app.get('/contact', function(req, res) { req.templateData = { weDidSomeCustomRendering: true }; var d = docpadInstance.getFile({relativePath:'hello.html.md'}); docpadInstance.serveDocument({document: d, req: req, res: res}, function(){}); }); 

这几乎是从文档直接复制,但不起作用。 有任何想法吗?

关键是要通过next

 app.get('/contact', function(req, res, next) { req.templateData = { weDidSomeCustomRendering: true }; var d = docpadInstance.getFileAtPath('pages/hello.html'); docpadInstance.serveDocument({document: d, req: req, res: res}, next); }); 

https://github.com/bevry/docpad/issues/706