25 lines
493 B
JavaScript

(async () => {
const caseId = "003abc000123xyzabc";
try {
console.log({ URL: req.url, body: req.body });
if (req.url.endsWith("token")) {
res.json({ access_token: "TOKEN" });
} else if (req.url.endsWith(caseId)) {
res.json({
id: caseId,
CaseNumber: 1024,
});
} else {
// create a case
res.json({ id: caseId });
}
} catch (error) {
res.json({
error: {
message: error.message,
},
});
}
})();