app.post("/token", async (req, res) => {
const { resume_session } = req.query; // resume_session is the ID of the session to resume
let url = "https://api.outspeed.com/v1/realtime/sessions";
if (resume_session) {
url += `?resume_session=${resume_session}`;
}
const response = await fetch(url, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.OUTSPEED_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify(req.body),
});
const data = await response.json();
res.json(data);
});