michaeldgraham / neo4j-graphql-server

A quick way to get started using neo4j-graphql-binding with Apollo Server.
https://neo4j-graphql-server.gitbook.io/docs/
MIT License
5 stars 1 forks source link

neo4j-graphql-server returning mock data #1

Open avaldevilap opened 5 years ago

avaldevilap commented 5 years ago

I just started using the package. I am using Grand Stack but I have problems with mutations and I saw this project but when I tried it it is giving me back mock data. Need help please

avaldevilap commented 5 years ago
import {
  augmentTypeDefs,
  augmentSchema,
  makeAugmentedSchema
} from "neo4j-graphql-js";
import { ApolloServer, gql, makeExecutableSchema } from "apollo-server";
import { Neo4jGraphQLServer } from "neo4j-graphql-server";
import { v1 as neo4j } from "neo4j-driver";
import { typeDefs, resolvers } from "./graphql-schema";
import { printSchema } from "graphql/utilities";
import dotenv from "dotenv";

dotenv.config();

const schema = makeAugmentedSchema({
  typeDefs,
  resolvers,
  config: {
    mutation: false
  }
});

const driver = neo4j.driver(
  process.env.NEO4J_URI || "bolt://localhost:7687",
  neo4j.auth.basic(
    process.env.NEO4J_USER || "neo4j",
    process.env.NEO4J_PASSWORD || "letmein"
  )
);

const server = Neo4jGraphQLServer({
  typeDefs: printSchema(schema),
  resolvers,
  driver,
  context: {
    driver
  }
});

server
  .listen(process.env.GRAPHQL_LISTEN_PORT || 3000, "0.0.0.0")
  .then(({ url }) => {
    console.log(`GraphQL API ready at ${url}`);
  });