Files
photoview/api/src/seed/seed-db.js
2019-07-05 00:36:32 +02:00

22 lines
563 B
JavaScript

import ApolloClient from "apollo-client";
import gql from "graphql-tag";
import dotenv from "dotenv";
import seedmutations from "./seed-mutations";
import fetch from "node-fetch";
import { HttpLink } from "apollo-link-http";
import { InMemoryCache } from "apollo-cache-inmemory";
dotenv.config();
const client = new ApolloClient({
link: new HttpLink({ uri: process.env.GRAPHQL_URI, fetch }),
cache: new InMemoryCache()
});
client
.mutate({
mutation: gql(seedmutations)
})
.then(data => console.log(data))
.catch(error => console.error(error));