Skip to content

A Node.js + Express.js + Mongodb REST API with JWT authentication

License

Notifications You must be signed in to change notification settings

hanoak/nodejs_rest_api_with_jwt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Node.js + Express.js + Mongodb REST API with JWT authentication

🖐 Hi there, here I've built a node.js + express.js + mongodb RESTfull API along with JWT authentication. Here I've took book database as an example for make CRUD operations via API calls 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

Endpoints

http://localhost:3000/auth
http://localhost:3000/get
http://localhost:3000/get/61783fccf74ebca4a95922a3
http://localhost:3000/post
http://localhost:3000/put
http://localhost:3000/delete

📸 ScreenShots:

Authentication authentication

GET method Get method

GET/id method Get method

POST method Post method

PUT method PUT method

DELETE method 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. 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 REST API with JWT authentication

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published