All examples use BASE_URL — set it to your deployment URL.
POST/api/sql/format
Beautify a SQL query with indentation.
const res = await fetch(`${BASE_URL}/api/sql/format`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ sql: "SELECT * FROM users WHERE active = 1" })
});
// → { success: true, result: "SELECT\n *\nFROM\n users\nWHERE\n active = 1" }
POST/api/sql/minify
Minify a SQL query to a single line.
await fetch(`${BASE_URL}/api/sql/minify`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ sql: "SELECT\n *\nFROM\n users" })
});
// → { success: true, result: "SELECT * FROM users" }