Closed lukeed closed 3 years ago
the /todos
routes return a { message: string }
JSON body for error responses, so that the proxying endpoint can just do
return {
status: res.status,
body: await res.json()
};
given that we're going to be rewriting large chunks of the app anyway, maybe we should standardise on something like that, rather than trying to minimise breakage.
(part of me wonders if endpoints should return Response
objects, like Remix, so that you can just do return res
without the [de]serialization roundtrip. but we had that convo and decided against it)
That's fine with me. My personal stuff is typically
{
status: number;
message: string;
stack?: string
for the response body. I can make a utility for us so that everything passes through for normalization.
I didn't go one way or another here since I figured we might want to change and standardize how errors are handled globally
Existing site returns an
{ error: string }
object for all error responses. Need to match that to minimize updates needed