An sms application that allows users send and receive messages.
The project structure follows the MVC (Model-View-Controller) pattern.
├── src
│ ├── config
│ │ └── database.js
│ │ └── environment.js
│ ├── controllers
│ │ └── ContactController
│ │ │ └── index.js
│ │ │ └── ContactController.js
│ │ └── SmsController
│ │ │ └── index.js
│ │ │ └── SmsController.js
│ │ └── index.js
│ ├── helpers
│ │ └── Error.js
│ ├── index.js
│ ├── middlewares
│ │ └── ContactValidator.js
│ │ └── SmsValidator.js
│ │ └── TokenValidator.js
│ ├── database
│ │ └── migrations
│ │ │ └── 20190624124752-create-contact.js
│ │ │ └── 20190624132504-create-sms.js
│ │ └── seeders
│ │ └── models
│ │ └── index.js
│ │ └── contact.js
│ │ └── sms.js
- Node.js
- npm
- PostgresDB
- Sequelize
$ git clone https://github.com/obulaworld/sms-management.git
$ cd population-management
$ npm install
$ npm run server # For development purpose
You should now be able to access the API via http://localhost:port/api/v1/
NOTE: Create a .env
file configuration following the .env.sample
.
SMS:
- person sending sms
- person receiving sms
- message of sms
- sms status
Contact:
- name of person
- phone number of person
The following relationships are represented in the model:
- All sms sent by a Contact are linked to them
- All sms sent to a Contact are linked to them
- Deleting a contact removes the messages they sent and references to messages they received.
HTTP VERB | ENDPOINTS | DESCRIPTION | QUERY |
---|---|---|---|
GET | /api/v1/contacts/:contactId | Gets a contact | |
POST | /api/v1/contacts/signup | Creates a contact | |
POST | /api/v1/contacts/login | logins a contact | |
DELETE | /api/v1/contacts/delete/:contactId | Deletes a contact | |
GET | /api/v1/messages/sent | Gets a contact sent sms | |
GET | /api/v1/messages/received | Gets a contact received sms | |
GET | /api/v1/message/:messageId | Gets a particular contact sms | |
POST | /api/v1/messages/:phoneNumber | Sends sms to a contact |