Skip to content

Commit

Permalink
fix: express res
Browse files Browse the repository at this point in the history
  • Loading branch information
thucpn committed Dec 25, 2024
1 parent 0fb520a commit 587b007
Showing 1 changed file with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,18 @@ export const sandbox = async (req: Request, res: Response) => {
const result = await sbx.runCode(artifact.code || "");
await sbx.kill();
const outputUrls = await downloadCellResults(result.results);
return new Response(
JSON.stringify({
template: artifact.template,
stdout: result.logs.stdout,
stderr: result.logs.stderr,
runtimeError: result.error,
outputUrls: outputUrls,
}),
);
return res.status(200).json({
template: artifact.template,
stdout: result.logs.stdout,
stderr: result.logs.stderr,
runtimeError: result.error,
outputUrls: outputUrls,
});
} else {
return new Response(
JSON.stringify({
template: artifact.template,
url: `https://${sbx?.getHost(artifact.port || 80)}`,
}),
);
return res.status(200).json({
template: artifact.template,
url: `https://${sbx?.getHost(artifact.port || 80)}`,
});
}
};

Expand Down

0 comments on commit 587b007

Please sign in to comment.