GraphQL is a query language for APIs that gives a more efficient alternative to REST. It enables declarative data fetching, meaning a client (web, mobile application e.t.c) can specify exactly what data it needs from an API on a single endpoint.
This repo contains example code to help you get started in your journey building GraphQL APIs 💪🏾
Codesandbox is an online IDE for quickly building web applications. 🏎
Create a free account on Codesandbox if you don't have one yet. 😉
Once you have signed in, select create a new sandbox which will be at the top right of the page. On the popup that shows up on the page, select import project option and under the Import from Github
section, paste in the following link: https://github.com/MicrosoftStudentAmbassadors-Kenya/GraphQL-Intro.git
. Once you are done, click import and fork.
You should see something that resembles this before selecting import and fork.:
Give it a moment to start up.... and ...⏲... done!
Your screen should resemble this:
If you've gotten this far, head over to the section on Trying your first query 🎉🎉
git clone [email protected]:MicrosoftStudentAmbassadors-Kenya/GraphQL-Intro.git
cd GraphQL-Intro
npm install # or alternatively yarn
npm start # or run yarn start
This runs the API in development mode.
Open http://localhost:4000 to interact with the ⚛ GraphQL Playground
Your GraphQL Playground should look something similar to this:
query GET_BOOKS {
books{
id
title
author
published
}
}
Press the Play button.... and we have lift off 👩🏾🚀👨🏾🚀🚀🚀
Congratulations! You just made your first GraphQL query 🎉🍾
This repository uses an in-memory database
Feel free to extend the starter code by connecting it to an existing database or integrate it with a REST API😉
You can make this repo your own by forking it as well 😀
Give this repo a ⭐ to help others find it.
Dive deeper into GraphQL fundamentals at https://www.howtographql.com/
Explore building GraphQL APIs with Apollo Server