Using Azure Functions
Embracing Serverless Architecture
Although “serverless” architecture is still a relatively new concept, it has the power to influence how you decide to build software today. Microsoft has a serverless offering that’s built on top of WebJobs called Azure Functions. An Azure Function is simply a block of code that is triggered by an event and automatically handles specific operations without having a web server deployed.
The term “serverless” does not mean that there’s no server involved. It just means you’re letting third-parties manage that service and you can focus on creating business value.
There are plenty of articles laying out details on which platforms offer the best service. From Amazon (Lambda), Google (Google Functions), IBM (Openwhisk) and Microsoft (Azure Functions). I’m solely focusing on Azure Functions.
What I Like About Functions
If you want to experiment with new concepts and have them readily available on the cloud, Azure Functions is a good fit. You can either develop your functions in the Azure Portal or locally and use continuous integration for deployment. There’s a CLI that’s available that can get you going quick.
Moving away from monolithic architecture
Instead of putting your server under pressure and have so many resources running under your it, you can have multiple functions that all run independently.
Triggers & Bindings
Triggers & bindings are essentially used to declare how the function works. Although bindings are optional, you can create an output binding with other services like Azure Queue Storage, Azure Cosmos DB, Twilio and many more.
- If you would like to create a simple endpoint that sends messages to Slack, that can be easily achieved.
- If you’re building a simple app with a front-end only, you can easily use the SendGrid binding to send emails without actively managing a server.
This is a C# Function that simply translates text using the Text Translator API. As you can see, after a few lines of code, you can have an event-driven translation service that’s completely independent of any other resources and readily available.