使用express和coffeescript。我想要發生的是,請求將從couchdb獲得test.htm,然後在瀏覽器上呈現該htm文件(這是正確的術語?)。如何從couchdb請求htm附件,然後在瀏覽器上作爲html?
我有這對我的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" }, ....
改變資源。發送myurl到res.render myurl
給我一個錯誤(500錯誤:無法查找視圖「[對象對象]」)。
我該怎麼做才能讓test.htm(來自couchdb)在瀏覽器上呈現爲html?
感謝您的幫助!