Hey is a decentralized and permissionless social media app built with Lens Protocol 🌿

Remove echo route and related functionality from API and service worker to streamline codebase

yoginth.com cbe0c741 e95f827e

verified
-27
-2
apps/api/src/index.ts
··· 5 5 import cors from "./middlewares/cors"; 6 6 import infoLogger from "./middlewares/infoLogger"; 7 7 import cronRouter from "./routes/cron"; 8 - import echo from "./routes/echo"; 9 8 import jumperRouter from "./routes/jumper"; 10 9 import lensRouter from "./routes/lens"; 11 10 import liveRouter from "./routes/live"; ··· 25 24 26 25 // Routes 27 26 app.get("/ping", ping); 28 - app.post("/echo", echo); 29 27 app.route("/lens", lensRouter); 30 28 app.route("/cron", cronRouter); 31 29 app.route("/live", liveRouter);
-13
apps/api/src/routes/echo.ts
··· 1 - import type { Context } from "hono"; 2 - 3 - const echo = async (ctx: Context) => { 4 - try { 5 - const body = await ctx.req.json(); 6 - console.info("Echoing body", body); 7 - return ctx.json({ success: true, body }); 8 - } catch { 9 - return ctx.json({ success: false, error: "Invalid JSON" }, 400); 10 - } 11 - }; 12 - 13 - export default echo;
-12
apps/web/public/sw.js
··· 10 10 const keys = await caches.keys(); 11 11 await Promise.all(keys.map((key) => caches.delete(key))); 12 12 13 - // Call backend to log cache clear 14 - fetch("https://api.hey.xyz/echo", { 15 - method: "POST", 16 - headers: { "Content-Type": "application/json" }, 17 - body: JSON.stringify({ 18 - timestamp: Date.now(), 19 - keys: keys.length 20 - }) 21 - }).catch(() => { 22 - // avoid blocking even if the request fails 23 - }); 24 - 25 13 // Reload all clients 26 14 const clientsList = await clients.matchAll({ type: "window" }); 27 15 for (const client of clientsList) {