async function getStudentByNo(stuno){ let whereCondition = `` if(stuno){ whereCondition = `\"where\":{\"stuno\":\"${stuno}\"},` } let response = await fetch("http://web2023.fmode.cn:9999/parse/classes/LcmUser", { "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" }, "referrer": "http://localhost:4040/", "referrerPolicy": "strict-origin-when-cross-origin", "body": `{`+whereCondition+`\"limit\":200,\"order\":\"createdAt\",\"_method\":\"GET\",\"_ApplicationId\":\"dev\",\"_ClientVersion\":\"js3.4.2\",\"_MasterKey\":\"devmk\",\"_InstallationId\":\"6ea3aea6-b781-4fba-b709-5de81c8a0fda\"}`, "method": "POST", "mode": "cors", "credentials": "omit" }); let result = await response.json(); if(stuno){ return result?.results?.[0] }else{ return result?.results } } module.exports.getStudentByNo = getStudentByNo async function main() { let student = await getStudentByNo("007"); console.log(student) console.log(student?.objectId) let studentList = await getStudentByNo(); console.log(studentList) } main() module.exports.getStudentByNo = getStudentByNo