好的。我在Express的response
object的源代码中找到了一个示例。这是该示例的稍作修改的版本。
app.get('/user/:uid/files/*', function(req, res){ var uid = req.params.uid, path = req.params[0] ? req.params[0] : 'index.html'; res.sendFile(path, {root: './public'});});它使用该
res.sendFile方法。
注意 :安全性更改
sendFile要求使用此
root选项。



