Skip to content

KyruCabading/graphql-mars-rover-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

freeCodeCamp-Elkgrove-graphql

Overview

A server that delivers NASA's Mars Rover API over a GraphQL endpoint.

This was the accompanying repo created during the Creating a GraphQL Server with Nodejs & graphql-yoga presentation

See Deployed api here: https://graphql-mars-rover-api.herokuapp.com

See Presentation here: https://docs.google.com/presentation/d/1grA9FNVYdam5E4GRWEVkG83DjTYrT7c1a2hq-JkSGqA/edit?usp=sharing

image

Getting Started: Installation

Run these commands in your terminal

git clone

yarn or npm install (installs the node modules required to run the server)

yarn dev or npm run dev (see package.json file under "scripts" for what this runs)

Visit localhost:5000 to see the graphiql and run queries against this endpoint!

Sample Queries

Querying Rover Manifest Data

query {
  rover(roverName: CURIOSITY) {
    name
    status
    landingDate
  }
}

Querying Rover Manifest Data & Photo Data

query {
  rover(roverName: CURIOSITY) {
    name
    photos {
      src
    }
  }
}

Using the same query multiple times in one graphql call. (Aliasing)

query {
  curiosity: rover(roverName: CURIOSITY) {
    name
    photos {
      src
    }
  }
  spirit: rover(roverName: SPIRIT) {
    name
    status << -- Notice they don't have to be exactly the same query
    photos {
      src
    }
  }  
}

About

A GraphQL Yoga server serving the Mars Rover API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published