This repo contains basic GraphQL Server which is developed using Node.js. About GraphQL-
- Application layer query language
- Open sourced by Facebook in 2015
- Can be used with any type of database
- Ability to ask for exactly what you need and nothing more
- Get multiple resources in a single request
Project Plan for this repo-
- Build the back end server
- Setup Express with Express-Graphql
- Create schema file with queries and mutations
- Implement JSON-server
- Crud functionality
- Test with Graphiql
Clone this repo using git clone https://github.com/nitesh009/GraphQL-Server.git
Once you clone the repo, you need to install few dependencies- npm install express express-graphql --save npm install graphql --save npm install json-server --save npm install nodemon --save npm install axios --save
After installing above mentioned dependencies, perform below steps- cd customerbase
-Run JSON-Server (Port 3000) $ npm run json:server
-Run Server (Port 4000) $ npm run dev:server -Visit Graphiql IDE
Go to http://localhost:4000/graphql
After that you can perform any of the CRUD operation mentioned below- addCustomer:
mutation{ addCustomer(name:"XYZ",email:"[email protected]",age:21) { id, name, email } }
deleteCustomer:
mutation{ deleteCustomer(id:"3") { id, name, email } }
Please comment if you face issues while performing any kind of CRUD operation.