From a12c50c9880848eaa50cdfef2b0e2fd56d38682b Mon Sep 17 00:00:00 2001 From: raizo07 Date: Tue, 28 May 2024 03:37:06 +0100 Subject: [PATCH] created a GET strategies endpoint --- src/app/api/strategies/route.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/app/api/strategies/route.ts diff --git a/src/app/api/strategies/route.ts b/src/app/api/strategies/route.ts new file mode 100644 index 0000000..8cd5287 --- /dev/null +++ b/src/app/api/strategies/route.ts @@ -0,0 +1,21 @@ +import { strategiesAtom } from '@/store/strategies.atoms'; +import { useAtomValue } from 'jotai'; +import { NextResponse } from 'next/server'; + +export const revalidate = 3600; // 1 hr +export async function GET(req: Request) { + const strategies = useAtomValue(strategiesAtom); + console.log(strategies); + try { + return NextResponse.json({ + status: true, + strategies: [], + }); + } catch (err) { + console.error('Error /api/strategies', err); + return NextResponse.json({ + status: false, + strategies: [] + }); + } +}