All examples use BASE_URL — set it to your deployment URL.
POST/api/html/encode
Convert special characters to HTML entities.
const BASE_URL = "http://localhost:3000";
const res = await fetch(`${BASE_URL}/api/html/encode`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ text: '<div class="test">&</div>' })
});
// → { success: true, result: "<div class="test">..." }
POST/api/html/decode
Decode HTML entities back to characters.
await fetch(`${BASE_URL}/api/html/decode`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ text: "<p>Hello</p>" })
});
// → { success: true, result: "<p>Hello</p>" }