math-dojo / user-account-service

Microservice for managing the users of the math-dojo platform
1 stars 0 forks source link

page_type: sample languages:

User Account Service

This is the user account service for the Math-Dojo platform. It is deployed as a serverless function on Azure.

Features

This is just a "Hello, world", but it uses domain objects so it's easy to extend to do something more complex.

Getting Started

Prerequisites

  1. Java SDK 1.8+ - The project uses maven wrapper.
  2. Docker - The project requires a working mongoDb installation. By default it will look for a database on localhost:27017.

Local Installation

Note: the src\main\azure\local.settings.json file is not read during unit tests, this why the mongoUri needs to be passed in as a separate environment variable.

Quickstart

Once the application is built, you can run it locally using the Azure Function Maven plug-in:

./mvnw azure-functions:run

❗❗❗ IMPORTANT ❗❗❗ - The Azure Functions Worker will take any environment vars in the current shell session into the app. These will take precedence over anything set in src\main\azure\local.settings.json.

And you can test it using a cURL command:

curl --location --request PUT 'http://localhost:7071/api/organisations/unknownOrganisationId/users/knownUserId/permissions' \
--header 'Content-Type: application/json' \
--data-raw '{
    "permissions": ["CONSUMER", "CREATOR"]
}'

Deploying to Azure Function

This is done via the Azure Pipelines yaml file in the root