我想从其mongo db集合“资产”中检索所有数据,其“ chapterName”等于通过url发送的字符串,如何获取?
struct FoodContentImageView: View {
var imageSelected: String
init(selectedImage: String){
imageSelected = selectedImage
}
var body: some View {
Image(imageSelected).resizable().frame(width: 200, height: 200, alignment: .center).scaledToFit()
}
}
答案 0 :(得分:0)
chapterName
将处于请求参数中,要求。假设章名出现在猫鼬模式中。
app.get('/api/assets/get_all/:chapterName}', (req, res) => {
Assets.find({ chaptername: req.params.chapterName }, (err, assets) => {
if (err) return res.status(400).send(err);
res.status(200).send(assets);
});
});