Giter Site home page Giter Site logo

phonebook-api's Introduction

Phonebook API

Phonebook API service in NodeJS, Express and MongoDB

Requirements

Write a Javascript based server (preferably using NodeJS and Express) that acts as an API and provides Phonebook services. The phonebook should contain phone numbers and subscribers. For any subscriber, one or more phone numbers can be assigned. For any phone number exactly one subscriber can be assigned. The records of the phonebook can be stored in a database, or locally on the server in the data structure of your choice. Make sure there are some pre-set records when you hand in your homework, so your server can be tested. (either by filling the local data structure, or sql commands to fill the database with example records) Subscriber's name could be anything. Incoming phone number's format should be validated against a pre-set regexp for EVERY request. Use Middleware for it if you can. Return an error message when the phone number was malformed in the request without fulfilling the original request.

Your API server should accept the following html requests:

  1. GET request to receive all the phonebook records in JSON format
  2. GET request that expects a phone number, and returns either the subscriber's name belonging to it, or a not found message (use correct HTML response codes in both cases)
  3. GET request that expects a subscriber's name and returns either all the phone numbers belinging to him/her, or a not found message (use correct HTML response codes in both cases)
  4. POST request that expects a name and a phone number, and adds these to your phonebook as a pair. Send an OK response if it is added, or an error message when the exact same record is already in the phonebook, or if the input is malformed. (use correct HTML response codes in all cases)
  5. POST request that expects a name and a phone number, and deletes the record defined by the input parameters. Send an OK response if it was deleted, or a not found message if the given record is not in the phonebook. (use correct HTML response codes in both cases)

Provide an example input for the requests you were able to finish during the homework in a text file. Write clean, well-organized, self documenting code.

phonebook-api's People

Contributors

medaharrat avatar

Stargazers

Roman avatar  avatar Tom Connors avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.