Skip to content

varunKT001/address-book-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ–ฅ๏ธ ADDRESS BOOK API

โœ… Test the API

https://address-book-api-assignment.herokuapp.com/

๐Ÿ’พ Database schemas

Contact schema

Field Type Required Unique Default
name String True False -
address String True False -
contact String True True -

๐ŸŒ APIs

Method Route Parameters Query parameters Body Description
GET /api/auth/get-jwt - - - Get JWT access token
GET /api/contact/id {id} - - Get single contact by using its ID
GET /api/contact/query - {name, address, contact} - Get contacts by using query parameters
GET /api/contact - {page, limit} - Get paginated list of contacts
POST /api/contact/new/single-contact - - {name: String, address: String, contact: String} Create new single contact
POST /api/contact/new/bulk-contact - - [{name: String, address: String, contact: String}] Create bulk contacts
PATCH /api/contact - {id} - Update existing contact details
DELETE /api/contact - {id} - Delete existing contact

๐Ÿ›  Installation and setup

  1. Clone the repo to your local machine.

  2. Install the required dependency for server using :

    npm install
  3. Create a .env file inside the root folder and provide the following environment variables:

    PORT=<port>
    MONGODB_URI=<mongo_uri>
    JWT_SECRET=<your_jwt_secret>
    JWT_EXPIRE=5d
  4. Start the dev server using :

    npm run dev

๐Ÿ˜Ž Developed by

GSSoC'22
Varun Kumar Tiwari
LinkedIn Github