//Foodcourt GET获取全部美食街 async function getFood(){ let response = await fetch("http://web2023.fmode.cn:9999/parse/classes/Delicacy?", { "headers": { "accept": "*/*", "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6", "x-parse-application-id": "dev" }, "referrer": "http://127.0.0.1:4040/", "referrerPolicy": "strict-origin-when-cross-origin", "body": null, "method": "GET", "mode": "cors", "credentials": "omit" }); if(response?.status=="200"){ let json = await response.json() return json?.results || [] }else{ return [] } } async function getPet(){ let response = await fetch("http://web2023.fmode.cn:9999/parse/classes/Foodcourt?", { "headers": { "accept": "*/*", "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6", "if-none-match": "W/\"a32-BlWXqWcse27iw72NLr5IFuxLE7g\"", "x-parse-application-id": "dev" }, "referrer": "http://127.0.0.1:4040/", "referrerPolicy": "strict-origin-when-cross-origin", "body": null, "method": "GET", "mode": "cors", "credentials": "omit" }); if(response?.status=="200"){ let json = await response.json() // console.log(json) return json?.results || [] }else{ return [] } } async function main(){ // let petList = await getPet() // console.log(petList) // let list = await ClassesGet("Pet") // console.log(list) let list = await ClassesGet("Student") console.log(list) } main() // 通过函数封装,实现多个表的查询 async function ClassesGet(className){ let response = await fetch("http://web2023.fmode.cn:9999/parse/classes/"+className, { "headers": { "accept": "*/*", "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6", "if-none-match": "W/\"19f-gvNjdCzTNrgDv/sckM9+BRABBVY\"", "x-parse-application-id": "dev" }, "referrer": "http://127.0.0.1:4040/", "referrerPolicy": "strict-origin-when-cross-origin", "body": null, "method": "GET", "mode": "cors", "credentials": "omit" }); // console.log(response) // return [] if(response?.status=="200"){ let json = await response.json() // console.log(json) return json?.results || [] }else{ return [] } } // // Pet POST 创建宠物 // fetch("http://web2023.fmode.cn:9999/parse/classes/Pet", { // "headers": { // "accept": "*/*", // "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6", // "content-type": "text/plain;charset=UTF-8", // "x-parse-application-id": "dev" // }, // "referrer": "http://127.0.0.1:4040/", // "referrerPolicy": "strict-origin-when-cross-origin", // "body": '{"name":"小强","type":"蟑螂","price":0.2}', // "method": "POST", // "mode": "cors", // "credentials": "omit" // }); // // Pet PUT 修改 // fetch("http://web2023.fmode.cn:9999/parse/classes/Pet/bl34OtuBYm", { // "headers": { // "accept": "*/*", // "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6", // "content-type": "text/plain;charset=UTF-8", // "x-parse-application-id": "dev" // }, // "referrer": "http://127.0.0.1:4040/", // "referrerPolicy": "strict-origin-when-cross-origin", // "body": "{\"price\":0.09}", // "method": "PUT", // "mode": "cors", // "credentials": "omit" // }); // // Pet DELETE 删除 // fetch("http://web2023.fmode.cn:9999/parse/classes/Pet/bl34OtuBYm", { // "headers": { // "accept": "*/*", // "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6", // "x-parse-application-id": "dev" // }, // "referrer": "http://127.0.0.1:4040/", // "referrerPolicy": "strict-origin-when-cross-origin", // "body": null, // "method": "DELETE", // "mode": "cors", // "credentials": "omit" // });