Code Monkey home page Code Monkey logo

hasura / learn-graphql Goto Github PK

View Code? Open in Web Editor NEW
1.2K 31.0 647.0 343.27 MB

Real world GraphQL tutorials for frontend developers with deadlines!

Home Page: https://hasura.io/learn/

License: MIT License

Dockerfile 2.24% JavaScript 21.26% CSS 14.76% HTML 3.25% Kotlin 4.88% TypeScript 14.68% Elm 11.46% Java 0.46% Ruby 0.34% Objective-C 0.11% Dart 5.37% Swift 7.19% Shell 0.01% Vue 3.96% Reason 2.45% SCSS 3.13% Less 0.01% ReScript 2.61% Svelte 1.85% Procfile 0.01%
graphql tutorial hasura apollo react vue angular flutter reasonml typescript elm hacktoberfest graphql-authentication graphql-tutorials

learn-graphql's Introduction

hasura.io/learn website Open Source

Real world GraphQL tutorials for frontend developers with deadlines! With these open-source community maintained tutorials, you will move from the basics of GraphQL to building a real-time application in 2 hours.

There are different tutorial series:

Frontend

Mobile

Backend

Database

GraphQL Basics

Contributing

Check out our contributing guide for more details.

License

This project is licensed under the MIT License - read LICENSE file for details.

Contributors

learn-graphql's People

Contributors

akiran avatar arjunyel avatar bookchiq avatar catalinpit avatar code0901 avatar console-log-kai avatar deadcoder0904 avatar dependabot-preview[bot] avatar dependabot[bot] avatar divyabhushan avatar elektronik2k5 avatar gautambt avatar gazuntype avatar itaditya avatar lilt-connector avatar makohan avatar mustafa-fahimi avatar naoaki-kaito avatar praveenweb avatar rantao123 avatar renovate[bot] avatar robertjdominguez avatar sassela avatar seanparkross avatar shark-h avatar surendran82 avatar timpratim avatar vardhanapoorv avatar wawhal avatar yagger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

learn-graphql's Issues

Implement DRY in services/homepage/src/components/Footer.js

Lots of repeatable code can be cleaned up πŸ‘‡

<div className='footer_links'>
	<a href="https://blog.hasura.io/" target="_blank" rel="noopener noreferrer">Blog</a>
</div>
<div className='footer_links'>
	<a href="https://learn.hasura.io/" target="_blank" rel="noopener noreferrer">GraphQL Tutorials</a>
</div>

Bug in Notification button in feed section of flutter app

There is a problem in notification button , that when it is pressed , the list view doesn't scroll to the top of the view .
Steps to reproduce :

  1. Open the flutter app and navigate to feed section .
  2. Scroll down and post something using textfield.
  3. New notifications button will appear but on click , it will not go to the top of the view .

how to create a HASURA_GRAPHQL_JWT_SECRET if your're not using Auth0 or Firebase

I can't find ways to create a NON firebase or Auth0 JWT secret on: https://hasura.io/learn/graphql/hasura-auth-slack/choosing-jwt-mode/2-secret-config/

There is a way to create this secret: https://hasura.io/jwt-config but it's limited to Firebase and Auth0.

Based on the Github repo: https://github.com/hasura/learn-graphql/tree/master/services/backend/auth-server I tried to understand which format

ENCRYPTION_KEY=<replace_it_with_your_JWT_SECRET> the secret must have.

Can you recommend me a way to generate an own secret like this? What's are the CLI commands to do this?

"-----BEGIN CERTIFICATE-----
MIIDDTCAfWgAwIBAgIJhNlZ11IDrxbMA0GCSqSIb3DQEBCwUAMCQxIjAgBgNV
BAMTGXlc3QtaGdlLWp3C5ldS5hdXRoMC5jb20HhcNMTgwNzMwMTM1MjM1WhcN
MzIwND3MTM1MjM1WjAkSIwIAYDVQQDExl0ZXNLWhnZS1qd3QuZXUuYXV0aDAu
Y29tMIBIjANBgkqhkiGw0BAQEFAAOCAQ8AMIICgKCAQEA13CivdSkNzRnOnR5
ZNiReD+AgbL7BWjRiw3RwjxRp5PYzvAGuj94yR6LRh3QybYtsMFbSg5J7fNq6
Ld6yMpMrUu8CBOnYY456b/2jlf+Vp8vEQuKvPOOw8Ev6x7X3blcuXCELSwyL3
AGHq9OP2RV6V6CIE863zzuYH5HDLzU35oMZqogJVRJM0+6besH6TnSTNiA7xi
BAqFaiRNQRVi1CAUa0bkN1XRp4AFy7d63VldOsM+8QnCNHySdDr1XevVuq6DK
LQyGexFy4niALgHV0Q7A+xP1c2G6rJomZmn4j1avnlBpU87E58JMrRHOCj+5m
Xj22/QDAQABo0IwQDAPgNVHRMBAf8EBTADAQHMB0GA1UdDgQWBBT6FvNkuUgu
tk3OYQi4lo5aOgwazAOgNVHQ8BAf8EBAMCAoQDQYJKoZIhvcNAQELBQADggEB
ADCLj+L22pEKyqaIUlhUJh7DAiDSLafy0fw56CntzPhqiZVVRlhxeAKidkCLV
r9IEbRuxUoXiQSezPqM//9xHegMp0f2VauVCFg7EpUanYwvqFqjy9LWgH+SBz
4uroLSZ5g1EPsHtlArLChA90caTX4e7Z7Xlu8G2kHRJB5nC7ycdbMUvEWBMeI
tn/pcbmZ3/vlgj4UTEnURe2UPmSJpxmPwXqBcvwdKHRMgFXhZxojWCi0z4ftf
f8t8UJIcbEblnkYe7wzYy8tOXoMMHqGSisCdkp/866029rJsKbwd8rVIyKNC5
frGYaw+0cxO6/WvSir0eA=
-----END CERTIFICATE-----
"

react-native tutorial boilerplate setup on Windows 10

Hi. I was asked to mention this here after a conversation in Discord.

I have a fresh install of Windows 10, Expo CLI 2.18.2, and Expo SDK v32.

When I follow the install directions at https://learn.hasura.io/graphql/react-native/setup the app won't run.

image

After a little research I discovered this is a babel issue. To troubleshoot I created a fresh expo init app and compared the default package.json with the one in the app_boilerplate download. The major difference was a missing babel entry... "babel-preset-expo": "^5.0.0",.

After adding it everything worked.

The working dev dependencies.

  "devDependencies": {
    "babel-eslint": "^10.0.1",
    "babel-preset-expo": "^5.0.0",  <--THIS 
    "eslint": "^5.16.0",
    "eslint-plugin-react": "^7.12.4",
    "jest-expo": "32.0.0"
  }

[Flutter] Subscriptions not working

The queries are OK, but seems like subscriptions have a problem with the authorization with the socket.
In my fork oh this repo have a version of the boilerplate updated to work with the latest version of the graphql_flutter, but can't figure out how to make the subscriptions work.
Someone know what is the problem?

{extensions: {path: $, code: start-failed}, message: cannot start as connection_init failed with : Authentication hook unauthorized this request}

hasura_flutter_tutorial_error

update react tutorial to support apollo client v3

The current react tutorial uses Apollo Client v2 stable. v3 changes some of the APIs. We can update the tutorial with the necessary changes.

  • cache.read and cache.write are replaced with cache.modify.

// TODO: Add more changes here.

Explicit cache update not needed when valid optimisticResponse defined in react apollo hooks?

Shouldn't the react-apollo-hooks/tutorial-site/content/optimistic-update-mutations/2-mutation-cache.md example just define a valid optimisticResponse and skip defining the cache update as that will be handled automatically by Apollo for a simple update?

E.g.

  const toggleTodo = () => {
    toggleTodoMutation({
      variables: { id: todo.id, isCompleted: !todo.is_completed },
      optimisticResponse: {
        update_todos: {
          __typename: 'todos_mutation_response',
          affected_rows: 1,
          returning: [
            {
              __typename: 'todos',
              id: todo.id,
              is_completed: !todo.is_completed
            }
          ]
        }
      },
    })
  }

Note that I am new to Hasura, Apollo and GraphQL so might be wrong about this πŸ˜„

Migrate class components to functional components

All components except Testimonials.js just have a render method. They don't use any special stuff which class components provide. Since there is a transpilation cost associated with class components, we should use function components instead.

Note- I'm not talking about adding hooks in the project. The only place where a hook would be useful is Testimonials.js but it is fine its current state. I'm just talking about other components which don't need hooks

upgrade vue to v3 in vue-apollo tutorial

The current vue-apollo tutorial uses Vue stable version 2.x. Now that Vue has reached beta v3, we can update the tutorial to support necessary changes like using Composition API (if required) etc.

Improper use of optimisticResponse

I noticed while following the React/Apollo tutorials (https://hasura.io/learn/graphql/react/optimistic-update-mutations/), that the view is not updating optimistically. Instead, it is waiting for the mutation to complete on the backend before updating the UI.

The reason appears to be examples like this in the tutorial:

clearCompleted() {
+  clearCompletedTodos({
+    optimisticResponse: null, // Here is the issue
+    update: (cache, {data}) => {
+      const existingTodos = cache.readQuery({ query: GET_MY_TODOS });
+      const newTodos = existingTodos.todos.filter(t => (!t.is_completed));
+      cache.writeQuery({query:GET_MY_TODOS, data: {todos: newTodos}});
+    }
+  });
}

I will start a PR to change these to:

optimisticResponse: true

[Doc] typescript-react-apollo/codegen "document" config

the "document" section from codegen.js seems not to work

"documents": [
    "./src/**/*.tsx",
    "./src/**/*.ts"
  ]

It throws such errors when I run yarn graphql-codegen --config codegen.js

βœ” Parse configuration
  ❯ Generate outputs
    ❯ Generate ./src/generated/graphql.tsx
      βœ” Load GraphQL schemas
      βœ– Load GraphQL documents
        β†’ Unable to find any GraphQL type definitions for the following pointers: ./src/**/*.tsx, ./src/**/*.ts
        Generate
    ❯ Generate ./graphql.schema.json
      βœ” Load GraphQL schemas
      βœ– Load GraphQL documents
        β†’ Unable to find any GraphQL type definitions for the following pointers: ./src/**/*.tsx, ./src/**/*.ts
        Generate


 Found 2 errors

Cannot login on boilerproject react native

Hi people,

I am following the 2 hour tutorial to graphQl with Hasura. Currently experiencing an issue with login in and signup in the expo boilerplate. The server responds with an error
Schermafbeelding 2020-03-08 om 22 09 34

Also tried to send some data to the url via Postman and responds with the same error

Does someone know what the issue might be? the code is unchanged and i am pretty sure it is a server issue.

Add Keycloak Integration Tutorial in learn.hasura.io

Hi guys,
I see that https://learn.hasura.io is a very helpful resource for creating application with Hasura and other useful stuff.
Now authentication tutorial is based on Auth0 I think another authentication tutorial also can be useful for example now we have https://www.keycloak.org/ as an open source alternative for https://auth0.com.
Keycloak also have a good production ready Hasura connector here: (Thanks to @httpsOmkar)
https://github.com/httpsOmkar/keycloak-hasura-connector

I think such tutorial can be very useful here:
https://learn.hasura.io/graphql/hasura/authentication

Thanks for your attention

create learn tutorial for svelte + apollo

Svelte is a framework for building reactive user interfaces. Using the same learn.hasura.io GraphQL Backend, we need to build the realtime todo app with svelte-apollo along with the tutorial content.

Typescript React Apollo tutorial missing type for optimisticResponse

I noticed that under the section Mutation and update cache, the todoUpdate mutation is missing type:

const [todoUpdate] = useMutation(TOGGLE_TODO);

After I add the type like below:

const [todoUpdate] = useMutation<ToggleTodoMutation, ToggleTodoMutationVariables>

The mutation cannot identify the type of optimisticResponse. Below is the screenshot error:

pic

Does anyone know how to fix this error? Thanks!

Bug in data transformations section

The given instructions with the last_seen screenshot and the text :

Enter the value as now() for the last_seen column and click on Save.

does not work, instead the instructions should be : go to browse rows, click on the row with ID 1 and name Praveen, click on the edit icon and make the changes there

Many attributes have unnecessary braces

There are a lot of unnecessary braces for className which might be confusing for beginners.

It doesn't even have conditionals. I'd like to tackle this one.

PS: Can u label it hacktoberfest

Edit: Not only className but href, alt, src & target have a lot of unnecessary braces but it's really not needed so I'll clean that up too

[Bug] Mutliple things are broken while setting up homepage locally

Currently these are the issues when setting up homepage service in local.

  1. There is no command called npm run develop. It should be either npm start or gatsby develop although I prefer the former. The README.md has incorrect instructions.
  2. The 3.1.4 version of gatsby-plugin-favicon is buggy while setting up on local. So it has to be updated to its latest version (v3.1.6 currently).
  3. The project requires js-yaml dependency but it is not listed in package.json.

I am making a PR for fixing all these issues.

Favorite is spelled inconsistently in the docs

Favorite is spelled as "favorite" and "favourite" in the docs, so it would make sense to achieve consistency between these spellings.

#32 fixes this by changing all of the instances of "favourite" to "favorite". (Supporting US spelling)

Error in $: Failed reading: not a valid json value. Non informative error message

I'm getting this not-informative error message. How can I see with Hasura what exactly was wrong with my json? Are there any options in Ui?

Error in $: Failed reading: not a valid json value

{
  "errors": [
    {
      "extensions": {
        "path": "$",
        "code": "invalid-json"
      },
      "message": "Error in $: Failed reading: not a valid json value"
    }
  ]
}

My test request looks like this:

    return fetch(apiUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      body: {
        query: "{ employee { id, name } }"
      }
    })

[Flutter Tutorial - Need Help] Error when signing up or logging in into the boilerplate todo app

I'm trying to follow the tutorial https://hasura.io/learn/graphql/flutter-graphql/setup/.

The app from https://hasura.io/learn/graphql/flutter-graphql/boilerplate.zip built successfully but when I try to sign up or login, the spinner kept on spinning on my emulators and I get the errors below in the Android Studio - Run console:

I really think Hasura has a lot of potential. Thank you in advance for your assistance!

E/flutter ( 8548): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: FormatException: Unexpected end of input (at character 1)

E/flutter ( 8548):

E/flutter ( 8548): ^

E/flutter ( 8548):

E/flutter ( 8548): #0 _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1394:5)

E/flutter ( 8548): #1 _ChunkedJsonParser.close (dart:convert-patch/convert_patch.dart:512:7)

E/flutter ( 8548): #2 _parseJson (dart:convert-patch/convert_patch.dart:32:10)

E/flutter ( 8548): #3 JsonDecoder.convert (dart:convert/json.dart:505:36)

E/flutter ( 8548): #4 JsonCodec.decode (dart:convert/json.dart:153:41)

E/flutter ( 8548): #5 jsonDecode (dart:convert/json.dart:96:10)

E/flutter ( 8548): #6 HasuraAuth.signup (package:app_boilerplate/services/auth.dart:45:15)

E/flutter ( 8548): <asynchronous suspension>

E/flutter ( 8548): #7 _SignupState.build.<anonymous closure> (package:app_boilerplate/screens/signup.dart:73:48)

E/flutter ( 8548): #8 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)

E/flutter ( 8548): #9 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:504:11)

E/flutter ( 8548): #10 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:282:5)

E/flutter ( 8548): #11 BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:217:7)

E/flutter ( 8548): #12 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:475:9)

E/flutter ( 8548): #13 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:76:12)

E/flutter ( 8548): #14 PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:122:9)

E/flutter ( 8548): #15 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:379:8)

E/flutter ( 8548): #16 PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:120:18)

E/flutter ( 8548): #17 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:106:7)

E/flutter ( 8548): #18 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:218:19)

E/flutter ( 8548): #19 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22)

E/flutter ( 8548): #20 GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7)

E/flutter ( 8548): #21 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7)

E/flutter ( 8548): #22 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7)

E/flutter ( 8548): #23 _rootRunUnary (dart:async/zone.dart:1196:13)

E/flutter ( 8548): #24 _CustomZone.runUnary (dart:async/zone.dart:1085:19)

E/flutter ( 8548): #25 _CustomZone.runUnaryGuarded (dart:async/zone.dart:987:7)

E/flutter ( 8548): #26 _invoke1 (dart:ui/hooks.dart:275:10)

E/flutter ( 8548): #27 _dispatchPointerDataPacket (dart:ui/hooks.dart:184:5)

Thanks @praveenweb and others...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.