0

i just create a gallery page in Node.js using help from Express and Cradle.io to communicate with CouchDB using this code below (images are saved in CouchDB attachment):

app.get("/album/:id", function(req, res){
var id  = req.params.id;
db.get(id, function(err, album){
    console.log(album);
    res.send(album);
})

and after some careful research i found out that although i just updated my database, and reload the page to resend /GET "album/:id" form browser, the Node server doesn't seem to update the "album" variable there. so what i miss here ?

DennyHiu
  • 4,861
  • 8
  • 48
  • 80
  • 1. where is the update code? 2. why `console.log` and not `res.send(album)`? – Sagish Feb 09 '14 at 16:31
  • i use res.send(album) in my actual code, here i use console.log(album) for simplification only. the problem is whenever /album/:id id called the value of "album" variable doesn't change. – DennyHiu Feb 09 '14 at 23:17
  • then it's possible the update code is not working. can you share it? – Sagish Feb 10 '14 at 07:25
  • doing just like the code above, and variable 'album' won't updates although, in CouchDB I just updated its value using FUTON and i have been check its value from FUTON, and its value are correct. It's seems that db.get() function just keep values from previous call. If i restarted my Node server, than album's value will be updated to its latest value. – DennyHiu Feb 10 '14 at 15:52

0 Answers0