October 29, 2021
Posted by: Ankit Kanojia
GraphQL is a query language (hence the “QL”) that describes exactly how a client should request information through an application programming interface called API. It is a syntax that developers can use to ask for specific data structures from multiple resources. Once a client defines the data structure in the request as needed, exactly the same structured JSON data will return from the server. Before being publicly released in 2015, GraphQL was developed internally by Facebook in 2012.
What is GraphQL Playground?
It is an interactive, graphical, IDE in the browser for GraphQL which is created by Prisma based on GraphQL. In development mode, GraphQL Playground is enabled on the same URL by Apollo Server (e.g. http://localhost:4000/graphql). Best effective tool or say IDE in-browser while can be used to test if your API is working or not.
In this article, we will learn how to write a simple Hello World GraphQL API using Node and Express.
Getting Started with Simple Hello world implement
Step 1: Configure project and install all dependencies
npm init -y
npm install express express-graphql graphql graphql-tag cors
Step 2: Create index.js file and write the below codes in that file and make it as a main entry point
const express = require('express')
const cors = require('cors')