如何从CouchDB获取特定文档并在Jade视图中将其导出?

时间:2019-05-26 12:23:45

标签: node.js json express couchdb pug

我需要获取URL,并据此在Jade视图中显示来自CouchDB的特定文档。

router.get('/jobs/:name', function (req, res, next) {
    couch.get(dbName,viewURLSpecific).then(function(data,header,status){
var name=req.params.name;
console.log(name);
res.render('detailedjobs',{name:data.data.rows});
},
function(err){
    res.send(err);
});
``` jade view
  .row
    .col-xs-12.col-sm-8
      .row.list-group 
        each detail in the name
          .col-xs-12.list-group-item
            h4 
              p #{detail.value.name}
              small  
              p #{detail.value.location} 

    .col-xs-12.col-sm-4 
      p.lead= sidebar

The view renders every document in my employer database. But I need to render the only a specific document, based on the name of the document, which is got from URL.

0 个答案:

没有答案