page_type: sample languages:
This is the user account service for the Math-Dojo platform. It is deployed as a serverless function on Azure.
This is just a "Hello, world", but it uses domain objects so it's easy to extend to do something more complex.
docker pull mongo
docker run -p 27017:27017 --name user-acc-svc-mongo -d mongo:latest
$env:SPRING_DATA_MONGODB_URI = 'mongodb://localhost:27017/test'; .\mvnw -ntp clean package
export SPRING_DATA_MONGODB_URI='mongodb://localhost:27017/test' && ./mvnw -ntp clean package
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.
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"]
}'
This is done via the Azure Pipelines yaml file in the root