From c1bc5993a694f6fd047a3881351827058042483b Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Sat, 13 Mar 2021 15:28:29 +0100 Subject: Use routify and GraphQL server --- src/config/apollo.js | 9 +++++++++ src/config/config.js | 8 +++++++- src/config/env.dist | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 src/config/apollo.js (limited to 'src/config') diff --git a/src/config/apollo.js b/src/config/apollo.js new file mode 100644 index 0000000..4cfca79 --- /dev/null +++ b/src/config/apollo.js @@ -0,0 +1,9 @@ +import { ApolloClient, InMemoryCache } from '@apollo/client/core'; +import { apollo as apolloConfig } from './config'; + +const cache = new InMemoryCache(); + +export const client = new ApolloClient({ + cache, + ...apolloConfig +}); diff --git a/src/config/config.js b/src/config/config.js index 6d819a3..0570e1c 100644 --- a/src/config/config.js +++ b/src/config/config.js @@ -1,4 +1,4 @@ -import { version as packageVersion } from '../../package.json'; +import { name, version as packageVersion } from '../../package.json'; /* * The main configuration object for the Forum frontend. These values @@ -6,6 +6,12 @@ import { version as packageVersion } from '../../package.json'; * file, otherwise it won't work. */ +export const apollo = { + uri: import.meta.env.VITE_APOLLO_SERVER, + name, + version: packageVersion +}; + export const socketServer = import.meta.env.FORUM_SOCKET_SERVER; export const version = packageVersion; diff --git a/src/config/env.dist b/src/config/env.dist index 0bcd782..1f3ff0c 100644 --- a/src/config/env.dist +++ b/src/config/env.dist @@ -1 +1 @@ -FORUM_SOCKET_SERVER=ws://location_of_socket_server +VITE_APOLLO_SERVER=http://location_of_apollo_server -- cgit