AdamZaczek / react-graphql

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

App requires adding myMongoCredentials.js file to sever folder with a link to mongolab database. It looks like this:

export default 'mongodb://SomeMongoLabUsername:SomeMongoLabPassword@ds129189.mlab.com:29189/stories';  

Useful queries to test api:

mutation CreateComment($content: String!, $_author:String!, $_story: String!) {
  createComment(content: $content, _author: $_author, _story: $_story) {
    content
  }
}

{
  "_story": "58951027734d1d3956c4289a",
  "content": "My very first comment yay!",
  "_author": "58961492734d1d3956c46fd0"
}
query storiesQuery($limit: Int!) {
  storiesQuery {
    edges {
      node {
      	id
        content
        createdAt
        comments(limit: $limit) {
          content
          _author {
            name
          }
        }
      }
    }
  }
}

{
  "limit": 2
}
{
  storiesQuery(first: 5) {
    totalCount
    edges {
      node {
        content
      }
    }
  }
}
query getUser($id: String!) {
  customUserQuery(id: $id) {
    email
  }
}

{
  "id": "58961492734d1d3956c46fd0"
}
query getStory($count: Int!) {
  recentStoriesQuery(count: $count) {
    content
  }
}

{
  "count": 3
}
mutation CreateUser($email: String!, $password: String!) {
  createUser(email: $email, password: $password) {
    email,
    createdAt
  }
}


{
  "email": "nowItDoesWork8@gmail.com",
  "password": "somePassword1"
}
mutation CreateStory($content: String!, $_author: String!) {
  createStory(content: $content, _author: $_author) {
    content
  }
}

{
  "content": "My very first story yay!",
  "_author": "58961492734d1d3956c46fd0"
}
{
  node(id: "VXNlcjo1ODk2MTQ5MjczNGQxZDM5NTZjNDZmZDA=") {
    ... on User {
      name
    }
  }
}

About


Languages

Language:JavaScript 100.0%