结合使用express和coffeescript。我希望发生的是,请求将从couchdb获得test.htm,然后呈现该htm文件(这是正确的术语吗?)在浏览器上。
我的app.coffee上有这个
app.get "/testreq", (req, res) ->
gets = require("request")
myurl = gets 'http://jims.iriscouch.com:5984/album/attachment_id/test.htm'
res.send myurl在我的浏览器上,当我转到"/testreq“时,我得到的是这些...
`{ "readable": true, "writable": true, "__isRequestRequest": true, "_redirectsFollowed": 0, "maxRedirects": 10, "followRedirect": true, "followAllRedirects": false, "setHost": true, "port": "5984", "host": "jims.iriscouch.com", "path": "/album/1d22186ee496b5ada564a9888d003203/test.htm", "uri": { "protocol": "http:", "slashes": true, "host": "jims.iriscouch.com:5984", "port": "5984", "hostname": "jims.iriscouch.com", "href": "http://jims.iriscouch.com:5984/album/1d22186ee496b5ada564a9888d003203/test.htm", "pathname": "/album/1d22186ee496b5ada564a9888d003203/test.htm", "path": "/album/1d22186ee496b5ada564a9888d003203/test.htm" }, ....` 将res.send myurl改为res.render myurl会给我一个错误(500错误:无法查找视图"object Object")。
我应该怎么做才能让test.htm (来自couchdb)在浏览器上呈现为html?
感谢您的帮助!
发布于 2012-10-08 06:23:15
这样啊,原来是这么回事!
myurl.pipe res感谢您的光临!
https://stackoverflow.com/questions/12773284
复制相似问题