diff --git a/client/src/apollo/client.ts b/client/src/apollo/client.ts index c798687..386a4a9 100644 --- a/client/src/apollo/client.ts +++ b/client/src/apollo/client.ts @@ -1,7 +1,10 @@ import { ApolloClient, HttpLink, InMemoryCache } from '@apollo/client'; -// GraphQL server address. Override with VITE_GRAPHQL_URL in .env (e.g. on the VM) -const uri = import.meta.env.VITE_GRAPHQL_URL ?? '/project2/graphql';; +// GraphQL server address. Override with VITE_GRAPHQL_URL in .env if needed. +// Dev: the local backend. Production build: Apache forwards /project2/graphql to the backend on the VM. +const uri = + import.meta.env.VITE_GRAPHQL_URL ?? + (import.meta.env.DEV ? 'http://localhost:3001/graphql' : '/project2/graphql'); export const client = new ApolloClient({ link: new HttpLink({ uri }), // how requests reach the server