Skip to content

Commit

Permalink
breaking: Endpoints for finding specific word/font/sign/language data…
Browse files Browse the repository at this point in the history
… now respond with 400 code error instead of 404, to signify that the route exists, but the input is invalid.
  • Loading branch information
TheOnlyTails committed Apr 23, 2024
1 parent ed99921 commit 0b48dfb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions api/src/server/v1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const app = new Hono()
? c.json({ ok: true as const, data: word })
: c.json(
{ ok: false as const, message: `Could not find the word ${c.req.param("word")}` },
404,
400,
);
},
)
Expand Down Expand Up @@ -154,7 +154,7 @@ const app = new Hono()
ok: false as const,
message: `Could not find the sandbox word "${c.req.param("word")}"`,
},
404,
400,
);
},
)
Expand All @@ -178,7 +178,7 @@ const app = new Hono()

return sign
? c.json({ ok: true as const, data: sign })
: c.json({ ok: false as const, message: `Could not find a sign named ${sign}` }, 404);
: c.json({ ok: false as const, message: `Could not find a sign named ${sign}` }, 400);
},
)

Expand All @@ -196,7 +196,7 @@ const app = new Hono()

return sign
? c.json({ ok: true as const, data: sign })
: c.json({ ok: false as const, message: `Could not find a sign named ${sign}` }, 404);
: c.json({ ok: false as const, message: `Could not find a sign named ${sign}` }, 400);
},
)

Expand All @@ -212,7 +212,7 @@ const app = new Hono()

return font
? c.json({ ok: true as const, data: font })
: c.json({ ok: false as const, message: `Could not find a font named ${font}` }, 404);
: c.json({ ok: false as const, message: `Could not find a font named ${font}` }, 400);
},
)

Expand Down

0 comments on commit 0b48dfb

Please sign in to comment.