A microservice for managing comments in the Babbly social media platform.
The Babbly Comment Service is a RESTful API that provides endpoints for creating, reading, updating, and deleting comments. It uses Apache Cassandra as its database and is designed to be deployed as a Docker container.
GET /api/Comment: Get all commentsGET /api/Comment/{id}: Get a specific comment by IDGET /api/Comment/post/{postId}: Get all comments for a specific postGET /api/Comment/user/{userId}: Get all comments by a specific userPOST /api/Comment: Create a new commentPUT /api/Comment/{id}: Update an existing commentDELETE /api/Comment/{id}: Delete a comment
GET /api/Health: Check service health
- ASP.NET Core
- C# 10
- Apache Cassandra
- Docker
- .NET 9.0 SDK
- Docker & Docker Compose
- Apache Cassandra (for local development without Docker)
The following environment variables can be configured:
ASPNETCORE_ENVIRONMENT: Development, Staging, or ProductionCassandraHosts: Comma-separated list of Cassandra hostsCassandraKeyspace: Cassandra keyspace nameCassandraUsername: Cassandra username (optional)CassandraPassword: Cassandra password (optional)
- Clone the repository
- Navigate to the root directory
- Run
docker-compose up -d - Access the API at
http://localhost:5004/swagger
- Start a local Cassandra instance
- Update
appsettings.Development.jsonwith your Cassandra configuration - Run
dotnet runfrom the project directory - Access the API at
http://localhost:5000/swagger
{
"id": "guid",
"content": "string",
"postId": "guid",
"userId": "string",
"createdAt": "timestamp"
}
The service uses a Cassandra keyspace named babbly_comments with the following tables:
CREATE TABLE IF NOT EXISTS comments (
id uuid PRIMARY KEY,
content text,
post_id uuid,
user_id text,
created_at timestamp
);CREATE INDEX IF NOT EXISTS ON comments (post_id);
CREATE INDEX IF NOT EXISTS ON comments (user_id);dotnet builddotnet testThis project is licensed under the MIT License - see the LICENSE file for details.