Coder Social home page Coder Social logo

meetup.graphql's Introduction

graphql

Code Chrysalis GraphQL Meetup

1. Server

Clone this repository to your computer. From the root directory, run npm install and npm start. Note: you will need to have node installed on your computer.

Visit http://localhost:4000/graphql to test that the server is running.

Here are some queries you can test:

{
  pokemons {
    id
    name
  }
}
{
  pokemon(name: "Pikachu") {
    id
    name
  }
}

2. Schema

  • Right now, the server is only set up to provide the Pokemon's id and name. What if you also wanted to get their weight, attacks, and evolutions?

  • To do that, you will need to update the schema. The schema (in server/index.js) should model the full data object available. Take a look at server/data/pokemon.js to see what other fields you can add to the schema.

  • Update your schema so it fully represents your Pokemon data object!

  • Test your work! Go back to GraphiQL to test some queries. Remember, the magic of GraphQL is that you don't have to get back the full data object, even if it is available. Click Docs on the right side of the explorer to see your full schema.

3. Resolvers

  • The resolvers in server/index.js are functions that return the data requested in the queries. You will notice that the names of these functions match the names of the queries listed in the type Query in your schema.

  • This is where you can add additional types of resolvers. Think about what other types of queries you are interested in and add them here!

  • This is also where you would add mutations (you would need to create a type called Mutation in your schema and list them there as well).

4. Queries & Mutations

  • You can continue to test all of this using localhost:4000/graphql. But let's say you want to connect a frontend to this server. The only endpoint for your server is /graphql– if you are fetching a resource, you will need to POST your query to that endpoint (whether it is a query or a mutation). Suggestion: check out Apollo-Fetch or Apollo-Client.

About Code Chrysalis

This meetup was hosted by Code Chrysalis, Japan's only advanced software engineering school focused on developing the next generation of tech leaders.

  • IMMERSIVE. Our 12 week program where we give you the skills to become a full stack software engineer with a Silicon Valley mindset.
  • FOUNDATIONS. Our part-time prep course for beginners who want to get started learning how to code.
  • ENGLISH PREP. Our part-time class where we teach conversational English in an interactive way.

meetup.graphql's People

Contributors

kmoroder avatar

Watchers

fasl avatar James Cloos avatar

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.