Skip to content

dondrzzy/sms-man-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status

Sms-Man-Api

This is an SMS management API that enables users to register their contacts, send and receive messages.

Application UI

The application API is live here.This is a node express API.

Pivotal Tracker with user stories

The user stories for the project are here.

requirements

Installation and setup

  1. Clone the repository.
git clone git@github.com:dondrzzy/sms-man-api.git
  1. cd into the application
cd <application folder>
  1. Install the application dependencies
npm install
  1. Set up some environment variables
Create a .env file at the root of the application and add the following env variables
- DB_NAME
- DB_URI=
- NODE_ENV=development  # leave as development for development environment and testing for testing environment
- SECRET_KEY
  1. Start you mongodb service, in your terminal run
mongod
  1. Spin up the server with
npm start or install nodemon with npm i nodemon and run nodemon
  1. Use postman or anyother REST API tool to make API calls.

Run npm run test to run tests with coverage.

Main API features

  • can register contact.
  • can get all contacts
  • can login contact
  • can delete contact -- this inturn deletes all messages sent by the contact
  • can send message to another contact
  • can view sent messages
  • can view sent message
  • can view received messages
  • can view received message

End points

Endpoint payload headers Method
/api/v1/contacts Contact header1 POST
/api/v1/contacts GET
/api/v1/contacts/login loginPayload header1 POST
/api/v1/contacts/contactId header2 DELETE
/api/v1/messages messagePayload header2 POST
/api/v1/messages/received header2 GET
/api/v1/messages/received/messageId header2 GET
/api/v1/messages/sent header2 GET
/api/v1/messages/sent/messageId header2 GET

API samples

header1

- Application/json

header2

- Application/json
- token-x

Contact

{
    "firstName": "peter",
	"lastName": "parker",
	"phoneNumber": "0711111113",
	"password": "#peter@1234"
}

Message

{
    "status": "sent",
    "createdAt": "2019-06-26T14:21:08.283Z",
    "_id": "5d137f787b193c24b322aa77",
    "sender": "5d137f567b193c24b322aa75",
    "receiver": "5d120c7dd37b6a3a25d1a1ad",
    "text": "hey yah!!!",
}

loginPayload


{
	"phoneNumber": "711111112",
	"password": "#user@1234"
}

messagePayload

{
	"receiver": "711111112",
	"text": "hey yah!!!"
}

Author: Sibo Donald

For more enquiries: Email me at sibo.donald16@gmail.com

About

SMS Management API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published