我已经安装了Json服务器。对此服务器的Get-Request正在传递期望的数据,但是现在我想向请求中添加一些搜索查询。但是结果仍然是一样的。我不知道我的错误是什么。
这是我的要求: http://localhost:3000/people?age=22
我还尝试了以下方法: http://localhost:3000/people?customer.age=22,但结果仍然是所有数据。
那是我的JSON文件:
{
"customer": [
{
"id": 1,
"name": "Stefan Winkler",
"phone_number": "017692601589",
"age": "22",
"education": "High School"
},
{
"id": 2,
"name": "Christoph Huber",
"phone_number": "094462649",
"age": "42",
"education": "nothing"
},
{
"id": 3,
"name": "Michael Unholer",
"phone_number": "093862649",
"age": "12",
"education": "Realschule"
}
]
}
答案 0 :(得分:1)
尝试
http://localhost:3000/customer?age=22
[
{
"id": 1,
"name": "Stefan Winkler",
"phone_number": "017692601589",
"age": "22",
"education": "High School"
}
]
http://localhost:3000/customer?name_like=rist
[
{
"id": 2,
"name": "Christoph Huber",
"phone_number": "094462649",
"age": "42",
"education": "nothing"
}
]