以特定的方式将数据从Express.js传递到Jade视图

我正在使用express.js和玉/帕格的意见。 我想dynamic地创build滑块,每个滑块从2张照片。

从现在起,我一个一个地渲染每个文件,就像这样:

router.get('/:id', (req,res) => { let query = {authUserName: req.user._id} Photo.find(query, (err, photos) => { if(err){ console.log(err); } else{ res.render('user_photos', { user: req.user, photos: photos, title: req.user.userName + ' photos' }) } }); }); 

和:

 block content h1.userPhotos #{user.userName} photos #imagesContainer each photo in photos .imgContainer .image a(href='/photos/edit/'+photo._id) img.edit-photo(src='/' + photo.path) 

这是我现在显示滑块的方式:

 block content h1.userPhotos #{user.userName} photos #imagesContainer img(src='/uploads/photos/1.jpg') img(src='/uploads/photos/2.jpg') 

然后我使用第三方库。

我想要显示的photos存储在photos目录中,名称为:

 photo_id5a1e9bd71f49972e2471a80f_nr28.png photo2_id5a1e9bd71f49972e2471a80f_nr28.png 

每个两个滑块的照片都有相同的名称,但photo/photo2前缀除外。 接下来的两张照片会有这样的名字:

 photo_diffrentID_nextNumber.png photo_idLikeAbove_numberLikeAbove.png 

所以我的问题是我该怎么做?