Mercurial
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 36:84672efec192 | 37:fb9bcd3145cb |
|---|---|
| 1 import { Router } from 'express'; | |
| 2 | |
| 3 | |
| 4 const WORDS: string[] = [ | |
| 5 "about","other","which","their","there","first","could","sound","great","again", | |
| 6 "still","every","small","place","right","think","three","house","point","water", | |
| 7 "after","thing","where","world","night","below","heavy","light","short","long", | |
| 8 "happy","angry","brown","black","white","green","plant","sweet","spice","bread", | |
| 9 "clock","chain","stone","brick","metal","paper","glass","chair","table","couch" | |
| 10 ]; | |
| 11 | |
| 12 export function createWorldeRouter() { | |
| 13 const router = Router(); | |
| 14 const randomIdx = Math.floor(Math.random() * WORDS.length); | |
| 15 router.get('/', async (_req, res) => { | |
| 16 res.json({ targetWord: WORDS[randomIdx] }); | |
| 17 }); | |
| 18 return router; | |
| 19 } | |
| 20 |