PostService is a microservice responsible for managing the storage of messages between users. The service utilizes MongoDB as the database for storing messages.
port 8090
MongoDB
To run PostService using Docker with the updated image "cybertobbe/postservice2" and build the services, follow these steps:
docker pull cybertobbe/postservice2
docker network create mynetwork
docker run -d --name mongodb --network=mynetwork -p 27017:27017 mongo:latest
docker run -d --name postapp1 --network=mynetwork -p 8090:8080 --env SPRING_DATA_MONGODB_URI=mongodb://mongodb:27017/mydatabase cybertobbe/postservice2
These commands will pull the updated image "cybertobbe/postservice2" and build the services postapp1 and mongodb.
PostService exposes the following endpoints:
POST https://localhost:8090/api/message: Saves a message to the database. Use JSON format to include the message in the request body.
Example:
{
"senderUsername": "TYPE THE NAME",
"recieverUsername": "TYPE THE NAME",
"message": "TYPE THE MESSAGE"
}
GET https://localhost:8090/api/message: Retrieves all saved messages from the database.
GET https://localhost:8090/api/message/sender/{senderUsername}: Retrieves all messages sent by a specific sender.
PostService uses MongoDB as the database. Make sure your MongoDB instance is configured according to the provided URI: mongodb://root:secret@mongodb:27017/mydatabase.