Reputation: 1673
Using express with coffeescript. What I want to happen is, request will get test.htm from couchdb, then have that htm file rendered (is that the right term?) on the browser.
I have this on my 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
On my browser, when I go to "/testreq", I get these instead...
{
"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"
},
....
Changing res.send myurl to res.render myurl
gives me an error (500 Error: Failed to lookup view "[object Object]").
What should I do to get test.htm (from couchdb) is rendered as html on the browser?
Thanks for helping!
Upvotes: 1
Views: 119