Skip to content

Latest commit

 

History

History

graphql

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Open in CodeSandbox

GraphQL API

This directory contains a Node.js GraphQL API application using @neo4j/graphql.

Try it live on CodeSandbox here

Setup

First, edit .env, replacing the defaults with your database connection string, user, and database (optional):

NEO4J_URI=
NEO4J_USER=
NEO4J_PASSWORD=
NEO4J_DATABASE=

The NEO4J_DATABASE environment variable is optional and can be omitted. When omitted the default database will be used.

Next, install dependencies.

npm install

Then start the API application,

npm run start

This will start a local GraphQL API server at localhost:4000.

Example GraphQL Queries

{
  hashtags(
    where: {
      name_IN: ["nodes2020", "twin4j", "neo4j", "grandstack", "graphql"]
    }
    options: { sort: name_DESC }
  ) {
    name
    tweets(options: { limit: 1 }) {
      text
      created_at
      posted_by {
        name
      }
      tags {
        name
        num_tweets
      }
    }
  }
}