async function main(){ let newUser = {"name":"xiaoming","gender":"男","age":26} let newSavedId = await createUser(newUser) console.log("newSavedId",newSavedId) console.log(await getUser()) let newUser1 = {"name":"zhansan","gender":"男","age":29} console.log(await updateUser(newSavedId,newUser1)) console.log(await getUser()) console.log(await deleteUser(newSavedId)) } main() async function deleteUser(id){ let response = await fetch("http://1.94.237.145:1339/parse/classes/test/"+id, { "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": "ylj", "Referer": "http://127.0.0.1:4040/", "Referrer-Policy": "strict-origin-when-cross-origin" }, "body": null, "method": "DELETE" }); return response?.json(); } async function updateUser(id,userInfo){ let body = JSON.stringify(userInfo) let response = await fetch("http://1.94.237.145:1339/parse/classes/test/"+id, { "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": "ylj", "Referer": "http://127.0.0.1:4040/", "Referrer-Policy": "strict-origin-when-cross-origin" }, "body": body, "method": "PUT" }); return await response?.json() } async function createUser(userInfo){ let body = JSON.stringify(userInfo) let response = await fetch("http://1.94.237.145:1339/parse/classes/test", { "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": "ylj", "Referer": "http://127.0.0.1:4040/", "Referrer-Policy": "strict-origin-when-cross-origin" }, "body": body, "method": "POST" }); let result = await response?.json(); return result?.objectId } async function getUser(){ let response = await fetch("http://1.94.237.145:1339/parse/classes/test?", { "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/\"127-p6+dUp7xlGAxzyvVsfuvVhMxjPo\"", "x-parse-application-id": "ylj", "Referer": "http://127.0.0.1:4040/", "Referrer-Policy": "strict-origin-when-cross-origin" }, "body": null, "method": "GET" }); let json = await response?.json(); return json?.results || [] }