import { format } from "npm:prettier/standalone";
import parserBabel from "npm:prettier/parser-babel";
export default async function(req: Request): Promise<Response> {
const { code } = await req.json();
const formattedCode = format(code, {
parser: "babel",
plugins: [parserBabel],
});
return new Response(formattedCode, { headers: { "Content-Type": "text/plain" } });
}