Skip to content

kennykay20/nodejs-app

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nodejs app with rest and graphql example

An example of GraphQL queries/mutations with Node and Express js.

With GraphQL, clients can specify exactly what data they need, and the server responds with only that data, reducing the amount of data transferred over the network.

Rest API Endpoint for get all users: http://localhost:5000/rest/getAllUsers

GraphQL Endpont: http://localhost:5000/graphql

Query for below scenarios:

  1. Get All Users with query operation

query{ getAllUsers{ id email } }

  1. Get single user details

query{ findUserById(id:1000){ id firstName lastName email } }

  1. Create User with mutation operation

mutation{ createUser(firstName:"sachin",lastName:"purohit",email:"sachin@sachin.com",password:"password"){ id firstName lastName email } }

Run the app with a script run

  • npm run start:dev --- to run the app on a watch mode with nodemon,
  • npm run start -- in a prod mode for instance

About

GraphQL Sample Application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%