I am trying to build a neo4j-graphql-js server with nodejs. I created a folder and ran "npm init" to generate the package.json file and accepted defaults. I further installed the neo4-driver,nodemon, neo4j-graphql-js and the appollo server I also tried to follow the example at Neo4j GraphQL Library - Neo4j GraphQL Library to set up the server I copied the code and placed in my index.js file. however when I run the script (index.js) using nodemon I am getting the
error: "import { makeAugmentedSchema } from 'neo4j-graphql-js'; SyntaxError: Unexpected token {"
I don't get it what am I doing wrong?
my code in the index.js is as follows:
import { makeAugmentedSchema } from 'neo4j-graphql-js';
import { ApolloServer } from 'apollo-server';
import neo4j from 'neo4j-driver';
import { neo4jgraphql } from "neo4j-graphql-js";
const typeDefs = `
type Movie {
title: String
year: Int
imdbRating: Float
genres: [Genre] @relation(name: "IN_GENRE", direction: "OUT")
}
type Genre {
name: String
movies: [Movie] @relation(name: "IN_GENRE", direction: "IN")
}
`;
const schema = makeAugmentedSchema({ typeDefs });
const driver = neo4j.driver(
'bolt://localhost:7687',
neo4j.auth.basic('neo4j', 'graph')
);
const server = new ApolloServer({ schema, context: { driver } });
server.listen(3003, '0.0.0.0').then(({ url }) => {
console.log(`GraphQL API ready at ${url}`);
});
const resolvers = {
Query: {
Movie(object, params, ctx, resolveInfo) {
return neo4jgraphql(object, params, ctx, resolveInfo);
}
}
};