This project is simply a graphql server that demonstrate how we can fetch data using graphql api instead of REST api approach where in a single query we can get much information as we want which is not the case with REST approach that needs couple of endpoints to do that.
- GraphQL
- Node.js
- Express
- Firsty to get started you have to clone this repository in your local repository by typing:-
$ git clone https://github.com/Ajin998/spaceX-graphql.git
- After that you have to install all the node dependencies in your project by doing:-
npm install
This will install all the node dependencies in your project
- After installing all the dependencies you are good to go with the application, Now to get start you have to type
npm start
- You will notice that the backend server is running on port 5000
- Head to localhost:5000/graphql
- You will notice that a GUI will open in your browser where you can simply query and get the result of the query, Basically a playground for graphql queries.
- Make a new file in your root directory as .env
- Inside .env file mention PORT=5000
NOTE:-
Setting env variable for PORT is optional
- To fetch all the launches by spaceX we specify launches as a root query.
- To fetch only single entry launch by id then we specify launch as a singular root query
- To fetch all rockets
- To fetch only single rocket with id
Ajin Varghese



