作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我找到的有关http.get请求抖动的所有文档都从数据库中获取所有数据,我只需要特定的数据,这就是为什么我在本例中的方法中必须将变量传递给服务器的原因?
Future<List<Phone>> getData() async {
String a="bonjour
http.Response response = await http.get(
Uri.encodeFull("http://192.168.43.24:27017/api/posts/gettdata"),
headers: {"Accept": "application/json"});
print(response.body);
List phonee = json.decode(response.body);
return phonee.map((phone) => new Phone.fromJson(phone)).toList();
}
将读取我的请求的服务器将是节点js服务器,我想知道如何找到我传递的参数。
router.get('/gettdatae', (req, res, next) => {
Post.find({imei: {name}}=)
.then((posts) => {
res.json(posts);
console.log(posts);
console.log("ok" + JSON.stringify(req.body) + req.body.imei);
})
.catch(err => console.log(err))
});
最佳答案
试试这个
Future<List<Phone>> getData() async {
String a="bonjour";
http.Response response = await http.get(
Uri.encodeFull("http://192.168.43.24:27017/api/posts/gettdata?a="+a),
headers: {"Accept": "application/json"});
print(response.body);
List phonee = json.decode(response.body);
return phonee.map((phone) => new Phone.fromJson(phone)).toList();
}
关于node.js - flutter 如何在http.get请求中传递变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61727236/
我是一名优秀的程序员,十分优秀!