Ocelot-Social/src/seed/seed-db.js
2018-11-21 15:16:55 +01:00

21 lines
531 B
JavaScript

import ApolloClient from "apollo-client";
import dotenv from "dotenv";
import gql from 'graphql-tag'
import fetch from "node-fetch";
import { HttpLink } from "apollo-link-http";
import { InMemoryCache } from "apollo-cache-inmemory";
import Seed from './data/index'
dotenv.config();
if (process.env.NODE_ENV === 'production') {
throw new Error('YOU CAN`T SEED IN PRODUCTION MODE')
}
const client = new ApolloClient({
link: new HttpLink({ uri: process.env.GRAPHQL_URI, fetch }),
cache: new InMemoryCache()
});
Seed(client)