Skip to content

fdaei/User-Service-Go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

User Service

This service manages user authentication and profile operations using Docker and Traefik.

Getting Started

To start the user service in development mode, run:

make start-user-app-dev

This command will spin up the service container.

Database Migration

To apply database migrations, run the following inside the running container:

docker exec -it beehive-user-service-1 sh -c "go run cmd/user/main.go migrate --up"

Traefik Proxy

The service uses Traefik as a reverse proxy for authentication routing.

API Documentation (Swagger)

You can find the Swagger UI for the API here:

http://beehive.local/users/v1/swagger/index.html

API Endpoints

Create User (Sign Up)

curl --location 'http://beehive.local/users/v1/users/signup' \
--header 'Content-Type: application/json' \
--data '{
    "name": "firoozeh",
    "phone_number": "09390815723"
}'

If the user already exists, an OTP code will be sent to the phone number.


Login (Request OTP)

curl --location 'http://beehive.local/users/v1/users/login' \
--header 'Content-Type: application/json' \
--data '{
    "phone_number": "09390315707"
}'

Verify OTP Code

curl --location 'http://beehive.local/users/v1/users/verify/otp' \
--header 'Content-Type: application/json' \
--data '{
    "phone_number": "09390315707",
    "otp_code": 52632
}'

Update Profile

Update user profile with a valid Bearer token:

curl --location --request PUT 'http://beehive.local/users/v1/users/verify/otp' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <your-jwt-token>' \
--data '{
    "name": "beehive"
}'

View Profile

Use a GET request to view the profile (endpoint URL example):

curl --location --request GET 'http://beehive.local/users/v1/users/profile' \
--header 'Authorization: Bearer <your-jwt-token>'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 16

Languages