The User Service is responsible for managing user information. It saves user data received from an authentication service through Kafka and provides various endpoints for managing user-related information.
- Features
- Getting Started
- Prerequisites
- Installation
- Usage
- API Endpoints
- Configuration
- Contributing
- License
- Todo
- Save user information received from the Auth Service via Kafka.
- Manage user info through various endpoints.
- CRUD operations for user data.
-
Clone the repository:
git clone https://github.com/yourusername/user-service.git cd user-service
-
Set up PostgreSQL:
Make sure you have PostgreSQL installed and running. Create a database for the service.
-
Configure the application:
Update the
application.properties
file with your database and Kafka configurations. -
Build and run the service:
./mvnw clean install ./mvnw spring-boot:run
The User Service listens to Kafka topics for user information and provides RESTful endpoints for managing user data.
-
Create User
- URL:
/users
- Method:
POST
- Description: Create a new user.
- Request Body:
{ "username": "string", "email": "string", "password": "string" }
- URL:
-
Get User by ID
- URL:
/users/{id}
- Method:
GET
- Description: Retrieve user information by user ID.
- URL:
-
Update User
- URL:
/users/{id}
- Method:
PUT
- Description: Update user information.
- Request Body:
{ "username": "string", "email": "string" }
- URL:
-
Delete User
- URL:
/users/{id}
- Method:
DELETE
- Description: Delete a user by ID.
- URL:
The service listens to the auth-service
topic for user information and processes the messages to save or update user data in the database.
The application configuration is managed through the application.properties
file. Ensure to update the following properties:
POSTGRES_HOST=db.example.com
POSTGRES_PORT=5432
POSTGRES_USER=myuser
POSTGRES_PASSWORD=mypassword
POSTGRES_DB=mydatabase
KAFKA_HOST=kafka.example.com
KAFKA_PORT=9092
USER_SERVICE_PORT=8080
- Add more endpoints
- Code comments