Message Service is a Django-based application designed to provide a robust messaging API. This project leverages the power and flexibility of Django to create an efficient and scalable messaging platform.
To set up Message Service on your local machine, follow these steps:
- Clone the Repository: Clone this repository to your local machine.
- Virtual Environment: It's recommended to create a virtual environment for this project to manage dependencies. You can use
virtualenv
orconda
to create one. - Install Dependencies: Run
pip install -r requirements.txt
to install the required Python dependencies. - Initial Setup: In settings.py update the Database config, Navigate to the project directory and run
python manage.py migrate
to set up the initial database schema.
To run the Message Service:
- Start the Django Server: Execute
python manage.py runserver
from the project directory. This will start the local development server. - Access the Application: The service will be available at
http://localhost:8000
.
The following API endpoints are available in this project:
- /get/messages/<account_id>: Returns all the messages with the sender and receiver details pertaining to the provided account id.
- /create: Post call which saves the message with the sender and receiver details.
- Search for keys using the following filters. Assume you have keys: message_id, sender_number, receiver_number
- /search?message_id=”1,2” would return messages with the given message ids.
- /search?sender_number=”1,2” would return messages with the given sender_number - can single sender number or multiple sender numbers under a given account ID.
- /search?receiver_number=”1,2” would return messages with the given receiver_number - can single sender number or multiple receiver numbers
If you prefer to use Docker:
- Build the Docker Image: Run
docker build -t message_service .
in the project directory. - Run the Docker Container: Execute
docker run -p 8000:8000 message_service
.