Skip to content

Commit 4e15b52

Browse files
lidiazuinrecrwplaymjfwebbdarrellwarde
authored
Adding final version of the index.js file #91 (#92)
* Add page-aliases for version 4 (#31) (#32) Co-authored-by: Neil Dewhurst <[email protected]> * Editorial review of the latest additions (#34) * Update publish.yml * Editorial review of the most recent changes * reverting changes to partials * fixing note formatting * Add page-aliases for version 4 (#31) (#32) Co-authored-by: Neil Dewhurst <[email protected]> * Editorial review of the most recent changes * fixing note formatting * Add page-aliases for version 4 (#31) (#32) Co-authored-by: Neil Dewhurst <[email protected]> * Editorial review of the most recent changes * fixing note formatting * Add page-aliases for version 4 (#31) (#32) Co-authored-by: Neil Dewhurst <[email protected]> * Editorial review of the most recent changes * Add page-aliases for version 4 (#31) * revert * Apply suggestions from code review Co-authored-by: Michael Webb <[email protected]> --------- Co-authored-by: Neil Dewhurst <[email protected]> Co-authored-by: Michael Webb <[email protected]> * Fix scalar description placeholders #38 (#39) * Editorial review of the most recent changes * reverting changes to partials * fixing note formatting * Add page-aliases for version 4 (#31) (#32) Co-authored-by: Neil Dewhurst <[email protected]> * Editorial review of the most recent changes * fixing note formatting * Editorial review of the most recent changes * fixing note formatting * Add page-aliases for version 4 (#31) (#32) Co-authored-by: Neil Dewhurst <[email protected]> * Editorial review of the most recent changes * Fix scalar description placeholders (#38) --------- Co-authored-by: Neil Dewhurst <[email protected]> Co-authored-by: Darrell Warde <[email protected]> * Editorial review of the most recent changes * reverting changes to partials * Add page-aliases for version 4 (#31) (#32) Co-authored-by: Neil Dewhurst <[email protected]> * Editorial review of the most recent changes * Editorial review of the most recent changes * fixing note formatting * Add page-aliases for version 4 (#31) (#32) Co-authored-by: Neil Dewhurst <[email protected]> * Editorial review of the most recent changes * Adding final version of the index.js file (#91) * fixing conflict --------- Co-authored-by: Neil Dewhurst <[email protected]> Co-authored-by: Michael Webb <[email protected]> Co-authored-by: Darrell Warde <[email protected]>
1 parent fb35bbf commit 4e15b52

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

modules/ROOT/pages/getting-started/index.adoc

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ cd neo4j-graphql-example
3535
npm init es6 --yes
3636
----
3737
+
38-
. Create an empty `index.js` file which with all of the code for this example:
38+
. Create an empty `index.js` file which will contain all of the code for this example:
3939
+
4040
[source, bash, indent=0]
4141
----
@@ -168,6 +168,46 @@ If successful, you should see the following output:
168168

169169
The address http://localhost:4000/ is the default URL in which Apollo Server starts at.
170170

171+
This is how your `index.js` file should look after following the previous steps:
172+
173+
[source, javascript]
174+
----
175+
import { ApolloServer } from '@apollo/server';
176+
import { startStandaloneServer } from '@apollo/server/standalone';
177+
import { Neo4jGraphQL } from "@neo4j/graphql";
178+
import neo4j from "neo4j-driver";
179+
180+
const typeDefs = `#graphql
181+
type Movie {
182+
title: String
183+
actors: [Actor!]! @relationship(type: "ACTED_IN", direction: IN)
184+
}
185+
186+
type Actor {
187+
name: String
188+
movies: [Movie!]! @relationship(type: "ACTED_IN", direction: OUT)
189+
}
190+
`;
191+
192+
const driver = neo4j.driver(
193+
"bolt://localhost:7687",
194+
neo4j.auth.basic("neo4j", "password")
195+
);
196+
197+
const neoSchema = new Neo4jGraphQL({ typeDefs, driver });
198+
199+
const server = new ApolloServer({
200+
schema: await neoSchema.getSchema(),
201+
});
202+
203+
const { url } = await startStandaloneServer(server, {
204+
context: async ({ req }) => ({ req }),
205+
listen: { port: 4000 },
206+
});
207+
208+
console.log(`🚀 Server ready at ${url}`);
209+
----
210+
171211
== Create nodes in the database
172212

173213
. Visit http://localhost:4000/ in your web browser.

0 commit comments

Comments
 (0)