From a4334b7597a7825b2faf7f465f4737246399a873 Mon Sep 17 00:00:00 2001 From: amalv <1252707+amalv@users.noreply.github.com> Date: Wed, 13 Dec 2023 22:34:10 +0100 Subject: [PATCH] feat: differentiate API URL based on NODE_ENV --- src/apolloClient.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/apolloClient.ts b/src/apolloClient.ts index 2de1d2d..92ad3b5 100644 --- a/src/apolloClient.ts +++ b/src/apolloClient.ts @@ -1,6 +1,11 @@ import { ApolloClient, InMemoryCache } from "@apollo/client"; +const isProduction = process.env.NODE_ENV === "production"; +const API_URL = isProduction + ? "https://fhdqwwo1yj.execute-api.us-east-1.amazonaws.com/" + : "http://localhost:3000"; + export const client = new ApolloClient({ - uri: "http://localhost:3000", + uri: API_URL, cache: new InMemoryCache(), });