summaryrefslogtreecommitdiff
path: root/backend/src/index.ts
blob: 58c5080e6faa9e16305e0b0250600ec3b7866ed5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import express from "express";
import cors from "cors";
import { WORDLIST } from "./wordlist";

const PORT = 4000;
const app = express();
app.use(cors());

app.get("/healthcheck", (req, res) => {
  res.send("HEALTHY");
});

app.get("/random-words", (req, res) => {
  res.send(
    new Array(16)
      .fill(0)
      .map(() => WORDLIST[Math.round(Math.random() * WORDLIST.length)])
  );
});

app.listen(PORT, () => {
  console.log("Initialized");
});