title | documentType |
---|---|
Function Monkey |
index |
Function Monkey
Write testable more elegant Azure Functions with less boilerplate, more consistency, and support for REST APIs.
Use a clean fluent API to create functions with all the boilerplate taken care of and runtime support for authorization and dependency injection.
public class FunctionAppConfiguration : IFunctionAppConfiguration
{
public void Build(IFunctionHostBuilder builder)
{
builder
.Setup((serviceCollection, commandRegistry) =>
{
serviceCollection
.AddLogging()
.AddNotificationServices(commandRegistry)
.AddExpensesService(commandRegistry)
.AddInvoiceServices(commandRegistry);
})
.Authorization(authorization => authorization.TokenValidator())
.AddFluentValidation()
.Functions(functions => functions
.HttpRoute("/api/v1/Invoice", route => route
.HttpFunction(AuthorizationTypeEnum.TokenValidation, HttpMethod.Get)
)
.ServiceBus("serviceBusConnection", serviceBus => serviceBus
.SubscriptionFunction("emaildispatchtopic", "emaildispatchsubscription"))
.Storage("storageConnectionString", storage => storage
.BlobFunction("expenses/{name}"))
);
}
}
Take advantage of the mediator pattern and underlying mediation framework to keep your codebase clean, super-DRY, and loosely coupled.