diff react_games/backend/routes/wordle.ts @ 37:fb9bcd3145cb

[ReactGames] Few games I made using react just to practice few things.
author MrJuneJune <me@mrjunejune.com>
date Mon, 01 Dec 2025 20:22:47 -0800
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/react_games/backend/routes/wordle.ts	Mon Dec 01 20:22:47 2025 -0800
@@ -0,0 +1,20 @@
+import { Router } from 'express';
+
+
+const WORDS: string[] = [
+  "about","other","which","their","there","first","could","sound","great","again",
+  "still","every","small","place","right","think","three","house","point","water",
+  "after","thing","where","world","night","below","heavy","light","short","long",
+  "happy","angry","brown","black","white","green","plant","sweet","spice","bread",
+  "clock","chain","stone","brick","metal","paper","glass","chair","table","couch"
+];
+
+export function createWorldeRouter() {
+  const router = Router();
+  const randomIdx = Math.floor(Math.random() * WORDS.length);
+  router.get('/', async (_req, res) => {
+    res.json({ targetWord: WORDS[randomIdx] });
+  });
+  return router;
+}
+