This microservice provides functionality for user authentication, file uploading, and file retrieval.
-
Environment Configuration
- To configure the environment variables, copy the
.env.sample
file to.env
within each microservice directory using the following commands:
For the Store Microservice:
cd store-microservice cp .env.sample .env
For the Retrieval Microservice:
cd retreival-microservice cp .env.sample .env
- To configure the environment variables, copy the
-
Running the Service
Start Docker Services:
```bash
docker-compose up
```
Run Store Microservice:
After the services are up and running, open a new terminal window or tab, navigate to the `store-microservice` directory, and execute the following command:
```bash
cd store-microservice
go run main.go
```
Running the above command will start the Store Microservice locally.
Note: Ensure that any necessary dependencies or environment variables are set before running the main.go
file.
-
Register User
- Method:
POST
- Endpoint:
/api/v1/user/register
- Request Body:
{ "username": "example", "email": "[email protected]", "password": "yourpassword", "first_name": "John", "last_name": "Doe" }
- Method:
-
Login User
- Method:
POST
- Endpoint:
/api/v1/user/login
- Request Body:
Note:
{ "identifier": "[email protected]", "password": "yourpassword" }
identifier
can be an email or username.
- Method:
-
Upload File
- Method:
POST
- Endpoint:
/api/v1/file
- Authentication: JWT Token required.
- Request: Form data with a field
file
,tag
andtype
.
- Method:
-
Get File
- Method:
GET
- Endpoint:
/api/v1/file
- Authentication: JWT Token required.
- Query Params:
tags
orname
for filtering files.
- Method:
-
Retrieve File Names
- Method:
GET
- Endpoint:
/api/v1/file/names
- Authentication: JWT Token required.
- Retrieves file names based on provided tags or name.
- Method:
- Postman Collection:
- Access the Postman collection in the
docs
folder for detailed API usage.
- Access the Postman collection in the
- To execute Golang tests for the Retrieval Microservice:
cd retrieval_microservice_directory go test ./...