GitXplorerGitXplorer
J

GraphQL-with-React

public
3 stars
0 forks
0 issues

Commits

List of commits on branch master.
Verified
afa8cf1a04f35f5192ae78b03f5d698a542ec990

Merge pull request #139 from JulianNicholls/dependabot/npm_and_yarn/lyrical/mongoose-8.9.5

JJulianNicholls committed 21 hours ago
Verified
8ddb5f6bb5fda78ec15b0207c4084c28033b7e9a

Bump mongoose from 8.8.3 to 8.9.5 in /lyrical

ddependabot[bot] committed a day ago
Verified
d09b080a10041f9c3f6e53a30aefca76f0e5b349

Merge pull request #138 from JulianNicholls/dependabot/npm_and_yarn/auth/nanoid-3.3.8

JJulianNicholls committed 2 days ago
Verified
72a0c87f29a5b67806d360a9a3ea718ffa84b0a9

Bump nanoid from 3.3.6 to 3.3.8 in /auth

ddependabot[bot] committed 2 days ago
Verified
2339e57074cf017bfea9a21aa120eb975c67a7df

Merge pull request #137 from JulianNicholls/dependabot/npm_and_yarn/auth/mongoose-8.9.5

JJulianNicholls committed 2 days ago
Verified
370d7bb7de7df33b98c34eb6f6cb19878edbf5b4

Bump mongoose from 8.8.3 to 8.9.5 in /auth

ddependabot[bot] committed 2 days ago

README

The README file for this repository.

GraphQL-with-React

Course code for the GraphQL with React course by Stephen Grider at Udemy.

Progress

  1. Working on Auth client

Query examples for reference

These are query and mutation examples to remember the syntax when it's more than just a simple query or mutation.

Name your queries in the GraphiQL interface

If you name your queries and mutations, then you can have multiple ones there and pressing the go button will then show a list of queries and mutations to run. e.g.

mutation signup {
  signup(email: "julian@example.com", password: "password") { email }
}

mutation login {
  login(email: "julian@example.com", password: "password") { email }
}

mutation loginBad {
  login(email: "julian@example.com", password: "notpassword") { email }
}

mutation logout {
  logout { email }
}

Fragments and Named Results

{
  first: company(id: "1") {
    ...companyDetails
  }

  company(id: "2") {
    ...companyDetails
  }
}

mutation {
  addCompany(name: "Woolworth") {
    ...companyDetails
  }
}

fragment companyDetails on Company {
  id, name, description
}

Parameterised Queries and Mutations

query Song($id: ID!) {
  song(id: $id) {
    id, title
  }
}

mutation AddSong($title: String!) {
  addSong(title: $title) {
    id
  }
}

Differences from Stephen

I have updated the version of most of the npm modules in use in the lyrical and auth applications.

  • I am using the latest React (16.10.x) and Apollo Client (2.x).

  • The latest Apollo client link seems to default to credentials: 'same-origin'.

  • it is not necessary to pass { dataIdFromObject: o => o.id } to ApolloClient because that is essentially the default (at least in v2.x).

  • Currently (03-Oct-2019), I have not updated to the latest react-router on either app.

  • I am using React Functional Components and Hooks instead of classes.

  • My user query is called currentUser.

  • For both lyrical and auth, my queries and mutations are in a single file in the client: .../queries/index.js. I think that in a large app, I would make more than one file for queries and mutations. I would probably not put each query or mutation in a separate file, but group them by function.

  • React hooks really shine in the auth requireAuth(). useEffect(...) is much more effective than the method that Stephen uses.

Git client

I have used Git at the command-line for more than 10 years. Over that time, I have tried many different graphical shells for Git, without finding one that was easier and nicer to use than the command-line (in my view).

I have now found that GitKraken is an excellent Git shell and would advise using it to everyone.

I have no connection with GitKraken or Axosoft, other than as a satisfied user.

Questions

If you have any questions about this repository, or any others of mine, please don't hesitate to contact me.