Skip to content

snlabsdlv/phonebook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PhoneBook API

A simple API for Contacts

Installation

Install PhoneBook with npm

  npm install

Run Locally

Clone the project

  git clone https://github.com/snlabsdlv/phonebook

Go to the project directory

  cd phonebook

Install dependencies

  npm install

Start the server

  node index.js

Swagger OpenApi Available

There is a Swagger Open Api specification Available once the app is running At the following address Swagger

Features

  • Phone Number Internation Prefix(validate)
  • Search (Enabled with name, workPhone,mobilePhone, email)
  • Sort and Limit(Pagination, not complete)
  • Standard Api Methods (GET,POST,DELETE,PATCH)
  • Swagger/OpenApi specification implemented here Swagger

Todo

  • Phone Number, Address , Email and Name validation
  • Add Timestamps (to each record)
  • Disable String type for numbers(for the sake of simplicity phone numbers are of type "string")
  • Sort and Limit(Pagination, not complete)
  • JWT Token to be implemented(jsonwebtoken)
  • Swagger OpenApi verify return status codes, and object/array
  • Optimize any search or filtering of objects/arrays
  • Refractor project to use Typescript
  • Use NestJS or Loopback for bigger projects

API Reference

Get all Contacts

  GET /api/
Parameter Type Description
sort string Sort Contacts by Name example(-1 or 1)
limit string Limit Contacts example: 5

Serch Contact by field

  GET /api/search
Parameter Type Description
name string Name of Contact
workPhone string Work Phone of Contact
mobilePhone string Mobile Phone of Contact
email string Email of Contact

Get Contact by Id

  GET /api/${id}
Parameter Type Description
id string Required. Id of Contact to fetch

Delete Contact

  DELETE /api/${id}
Parameter Type Description
id string Required. Id of Contact to fetch

Update Contact

  PUT /api/${id}
Parameter Type Description
id string Required. Id of Contact to fetch
Body Type Description
name string Name of Contact
workPhone string Work Phone of Contact
homePhone string Home Phone of Contact
mobilePhone string Mobile Phone of Contact
address string Address of Contact
email string Required Email of Contact

Create/Add Contact

  POST /api/
Body Type Description
name string Name of Contact
workPhone string Work Phone of Contact
homePhone string Home Phone of Contact
mobilePhone string Mobile Phone of Contact
address string Address of Contact
email string Required Email of Contact

Feedback

If you have any feedback, please reach me at [email protected]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published