Skip to content

hanoak/nodejs_graphql_with_jwt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Node.js + Express.js + Mongodb GraphQL with JWT authentication

🖐 Hi there, I've built a node.js + express.js + MongoDB GraphQL along with JWT authentication. Here I've taken book-database as an example for making CRUD operations via GraphQL queries with JWT authentication. Please go through the screenshots to know more about endpoints. Feel free to use this code and work around it. Hope you got the insights!

📦packages used:

  1. bcryptjs - Password hashing
  2. jsonwebtoken - for generating JWT
  3. express-validator - Input validation
  4. mongodb - mongodb cluster
  5. mongoose - ODM
  6. express - node.js framework
  7. express-graphql & graphql - for defining schema and resolvers

Endpoints

http://localhost:3000/graphql

📸 ScreenShots:

Authentication authentication

GET Query Get method

GET/id Query Get method

POST (Mutation) Post method

PUT (Mutation) PUT method

DELETE (Mutation) DELETE method

😀How to use this project

  1. Well, first clone or download this repo.
  2. Create a cluster in mongodb Atlas, and then create a collection, and get your access URL to your cluster's database and paste it in app.js for MONGODBURL variable.
  3. Run "npm install" to install dependent packages for the app.
  4. Create a document with email and password(bcrypt hashed) in user collection for you to authenticate yourselves.
  5. Now, you're ready to go!

📰License

MIT

❤️Loved this project?

Please give me a star⭐ to this repo, I'll be happy😊.

🔗 Let's connect!

linkedin

twitter

twitter

medium

About

A Node.js + Express.js + Mongodb GraphQL with JWT authentication

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors