Skip to content

REST API created in NodeJs using Express for Displaying,Storing,Updating Books Records stored on MongoDB.

License

Notifications You must be signed in to change notification settings

ShadmanAfzal/BooksApi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BooksApi

REST API created in NodeJs using Express for Displaying,Storing,Updating Books Records stored on MongoDB.

Technology Stack Used

  1. NodeJS (Express)

Packages Used

  1. Express npm install --save express
  2. dotenv npm install --save dotenv
  3. mongoose npm install --save mongoose
  4. jsonwebtoken npm install jsonwebtoken
  5. nodemon npm install --save-dev nodemon

How to use

  1. First, install all the dependencies using npm install
  2. Edit package.json
    "scripts": {
    "start": "nodemon index.js"
    }
  1. Then Create a .env file, and add
USER_NAME: admin
PASSWORD: admin123
ACCESS_TOKEN_SECRET: UNIQUE_KEY
  1. To create unique key, open terminal and type node, then,
require('crypto').randomBytes(16).toString('hex')
  1. To start the Server
npm start
  1. You need to have jwt token to add books, update records, and delete records.
  2. To get the JWT Token.
  • Make a POST Request to /login, which will return accessToken, this will expire in 30 minutes.
  • Add Authorization in Header section to make POST Requests.
  "authorization": "Bearer ${token}" 

About

REST API created in NodeJs using Express for Displaying,Storing,Updating Books Records stored on MongoDB.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published