Skip to content

Latest commit

 

History

History

graphql-getting-started

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

GraphQL getting started

Run server

ts-node index.ts

Sample request

Query

graphql

curl -H "Content-Type:application/graphql" -X POST http://localhost:3000/blog -d '
  query {
    users {
      name
      email
      posts {
        title
      }
    }
  }'

json

curl -H "Content-Type:application/json" -X POST http://localhost:3000/blog -d '
  { "query" : "query { user(id: 1){name} }" }'

Mutation

curl -H "Content-Type:application/graphql" -X POST http://localhost:3000/blog -d '
  mutation {
    registerPost(authorId: 2, title:"test") {
      id
      title
      link
    }
  }
'