Service responsible for storage files into Azure Storage.
First you need to have Swift installed on your computer. Next you should run following commands:
$ git clone https://github.com/Mikroservices/FilesAzureStorage.git
$ cd FilesAzureStorage
$ swift package update
$ swift build
If application successfully builds you need to set up all required environment variables:
Variable | Description |
---|---|
MIKROSERVICE_JWT_PUBLIC_KEY | JWT public key for validation access token |
MIKROSERVICE_AZURE_STORAGE_SECRET_KEY | Secret key for Azure storage |
MIKROSERVICE_AZURE_STORAGE_ACCOUNT_NAME | Account name for Azure storage |
JWT key must be public key from pair private/public keys which is used in User
microservice.
Private key is used for signing-in JWT access token.
You can set up this variable as:
- environment variable in your system
- environment variable in XCode
Now you can run the application:
$ .build/debug/Run --port 8004
If application starts open following link in your browser: http://localhost:8004. You should see blank page with text: Service is up and running!. Now you can use API which is described below.
Service provides simple RESTful API. Below there is a description of each endpoint.
POST /files
- create new fileGET /files
- get all user filesGET /files/{groupName}
- get all user files from specific groupGET /files/{groupName}/{fileName}
- get file data
Service (for now) cannot return file content. However in your web application you should use directly Azure storage API. For example you should have below URL:
https://{storageAccountName}.blob.core.windows.net/{userName}/{groupName}/{fileId}