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.
- Clone the repository.
git clone git@github.com:dondrzzy/sms-man-api.git
- cd into the application
cd <application folder>
- Install the application dependencies
npm install
- 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
- Start you mongodb service, in your terminal run
mongod
- Spin up the server with
npm start or install nodemon with npm i nodemon and run nodemon
- Use postman or anyother REST API tool to make API calls.
Run
npm run test
to run tests with coverage.
- 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
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 |
- Application/json
- Application/json
- token-x
{
"firstName": "peter",
"lastName": "parker",
"phoneNumber": "0711111113",
"password": "#peter@1234"
}
{
"status": "sent",
"createdAt": "2019-06-26T14:21:08.283Z",
"_id": "5d137f787b193c24b322aa77",
"sender": "5d137f567b193c24b322aa75",
"receiver": "5d120c7dd37b6a3a25d1a1ad",
"text": "hey yah!!!",
}
{
"phoneNumber": "711111112",
"password": "#user@1234"
}
{
"receiver": "711111112",
"text": "hey yah!!!"
}
For more enquiries: Email me at sibo.donald16@gmail.com