VuNguyen
11/01/2021, 9:19 AMgaIaxy
11/01/2021, 11:48 AMekko
11/01/2021, 11:50 AMgaIaxy
11/01/2021, 12:07 PMsilentworks
11/01/2021, 12:18 PMsilentworks
11/01/2021, 12:19 PMchadyj
11/01/2021, 2:36 PMgaIaxy
11/01/2021, 4:08 PMsockenguy
11/01/2021, 4:44 PMjs
export default async function handler(
  req: NextApiRequest,
  res: NextApiResponse
) {
  const snippets = await prisma.snippets.findMany();
  const allSnippets: ISnippet[] = snippets.map((snippet) => ({
    ...snippet,
    id: snippet.id.toString(),
  }));
  res.status(200).json({ allSnippets });
}js
export async function getServerSideProps() {
  const res = await fetch("http://localhost:3000/api/snippet");
  const snippets = await res.json();
  return {
    props: { snippets },
  };
}error - FetchError: invalid json response body at http://localhost:3000/api/snippet reason: Unexpected token < in JSON at position 0
error - TypeError: Do not know how to serialize a BigIntsockenguy
11/01/2021, 4:48 PMmlusetti
11/01/2021, 5:01 PMchadyj
11/01/2021, 5:04 PMmlusetti
11/01/2021, 5:05 PMmlusetti
11/01/2021, 5:06 PMmlusetti
11/01/2021, 5:14 PMScott P
11/01/2021, 6:24 PMpedrig
11/01/2021, 7:14 PMblurblur
11/01/2021, 8:26 PMMike92988
11/01/2021, 11:27 PMVuNguyen
11/02/2021, 12:13 AMgaryaustin
11/02/2021, 12:46 AMjason-lynx
11/02/2021, 1:39 AMuser
11/02/2021, 2:50 AMdmio
11/02/2021, 9:59 AMIlko Kacharov
11/02/2021, 10:41 AMIlko Kacharov
11/02/2021, 10:44 AMmrpaulb
11/02/2021, 11:55 AMgawlk
11/02/2021, 1:32 PMconst { data: parts } = await supabase
      .from('parts')
      .select(
        "CONCAT(root, '-', REPEAT('0', 5 - length(number::TEXT)), number, '-', revision) AS SERIAL"
      )
      .order('serial')gawlk
11/02/2021, 1:34 PM