consdu / contact-in-back

Final backend project for my ISDI Coders bootcamp graduation 2023

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Contact-in API

This is the web api for the Contact-In app.

The application is structured as follows:

  • A server made with Express.js
  • MongoDB for data persistance

The API includes authorization, in order to access the protected routes you need to login with valid credentials and send your token on each request.


Metrics

Quality Gate Status Coverage Bugs Code Smells Maintainability Rating


API Reference

Check if server is up

  GET /

Response: 🏓 Pong

Login

  POST /user/login
Body Type Description
username string Required. Your username
password string Required. Your password

Response: Wrong credentials or a Json Web Token

Get all Contacts

  GET /contacts
Header Type Description
Authorization string Required. Your JWT token

Response: A collection of contacts

Delete contact

  DELETE /contacts/${id}
Parameter Type Description
id string Required. Id of contact to delete

Response: Error or Success message

Create contact

  POST /contacts
Body Type Description
contact object Required. Contact data

Response: Created contact or error response

Search contacts

  GET /contacts/search/?name=*
Query param Type Description
name string Required. Minimum a letter

Response: Collection of contacts matching where name or surname matches includes the pattern

Get one contact

  GET /contact/id/:contactId
Param Type Description
contactId string Required. Contact's id to retrieve

Response: A contact whose id matches the param or an error with message 'no contact found'

Update a contact

  PUT /contact/
Body Type Description
contact object Required. Contact data

Response: A message confirming the contact was updated

About

Final backend project for my ISDI Coders bootcamp graduation 2023


Languages

Language:TypeScript 95.2%Language:JavaScript 3.1%Language:Shell 1.8%