// Node.js Grammar Fix + Clean Text Tool (Express + HTML Frontend) // Fully SEO-Optimized + CTA + FAQ
// — server.js — import express from “express”; import bodyParser from “body-parser”; import cors from “cors”; import path from “path”; import { fileURLToPath } from “url”; import { cleanAndFixText } from “./utils/cleanAndFixText.js”;
const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename);
const app = express(); app.use(cors()); app.use(bodyParser.json()); app.use(express.static(path.join(__dirname, “public”)));
// API endpoint for cleaning & grammar fixing app.post(“/api/clean-text”, async (req, res) => { try { const { text } = req.body; if (!text) return res.status(400).json({ error: “No text provided” });
const cleanedText = await cleanAndFixText(text);
res.json({ cleanedText });
} catch (error) { res.status(500).json({ error: “Something went wrong” }); } });
const PORT = process.env.PORT || 3000; app.listen(PORT, () => console.log(๐ Server running on port ${PORT}));
// — utils/cleanAndFixText.js — export async function cleanAndFixText(text) { let cleaned = text .replace(/\s+/g, ” “) // extra spaces remove .replace(/\n+/g, “\n”) // multiple line breaks fix .trim(); cleaned = cleaned.charAt(0).toUpperCase() + cleaned.slice(1); return cleaned; }
// — public/index.html —
Clean & Fix Article Text | Free AI Tool
Paste Your Article
Copied!
Why Use Our Tool?
โ Grammar Fix: Instantly correct grammar & punctuation.
โ SEO Friendly: Clean formatting improves search ranking.
โ Free & Fast: No signup required, works in seconds.
FAQ
Q: Is this tool free?
A: Yes, 100% free forever.
Q: Can I use it for long articles?
A: Absolutely, it supports large text.
Q: Is my data safe?
A: Yes, we do not store your text.