All examples use BASE_URL — set it to your deployment URL.
POST/api/text/stats
Get detailed text statistics: characters, words, sentences, reading time, and top character frequency.
const BASE_URL = "http://localhost:3000";
const res = await fetch(`${BASE_URL}/api/text/stats`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ text: "Hello world. This is a test." })
});
const data = await res.json();
// → { success: true, characters: 28, charactersNoSpaces: 23,
// words: 6, sentences: 2, paragraphs: 1, lines: 1,
// readingTime: "1 min", topChars: [["l",3], ["s",3], ...] }