Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the point of writing REST APIs but in Azure Functions? [closed]

I've just started following some Azure Function tutorials and digging into this more so I'm quite New to this and my question may seem very easy but I couldn't find any answer for it yet.

What is the point of creating REST APIs using Azure Functions?

I mean, if we need to have some APIs then why not using ASP.NET Core or ASP.NET Web API itself? Should we say that we only expose APIs with Azure Functions that takes care of lightweight operations? Or basically when of course we're not talking about building up a web application?

Because, my mindset was that we use Azure Functions instead of Background Processor, for example, we can replace a Windows Service with an Azure Function. But, now that I have seen this API feature with Azure Func, then I'm curious to find out what's the point of that in an actual commercial product?

like image 976
Ali Avatar asked Feb 06 '19 10:02

Ali


People also ask

Is Azure function a REST API?

When building REST APIs with Azure Functions, there are some things we should keep in mind: Azure Function is a great way to bring your complete software architecture into the cloud. We are setting the Route metadata for our trigger for a distinct REST-style description.

Can Azure function replace web API?

Conclusion. Migrating from a simple web API that has little commercial pressure to Azure Function can save significant development and operational costs. By using the serverless platform, we can focus on the business logic itself rather than the infrastructure code.

What are the disadvantages of Azure functions?

Vendor-lock is the biggest drawback of this functions. It is very difficult to run code deployed in Azure function outside the azure environment. As the language used in function app such as java, NodeJS, etc are not specialized but code to establish a connection between resources is specific to azure.

Can we call API from Azure function?

Depending upon your requirement you can create any of supported trigger to trigger your function app and your function app code will make the HTTP calls. You can refer to Call a Web API From a . NET Client (C#) document for more details. Sharing the previous discussion on the same.


1 Answers

The two big reasons for using functions instead of running a web app are cost and scalability. If your API is getting constant traffic at the same level 24/7 then using a function is not going to be beneficial.

However, if your API is only really getting traffic for a few hours a day, then using a function is likely to save you money, as when no one is hitting it, or load is low, your costs will be very small. Similarly, if your API traffic is very spiking, and you could see large increases in load for short periods, then functions work well for this as they can scale quickly to meet the demand and then scale down again.

like image 185
Sam Cogan Avatar answered Nov 14 '22 04:11

Sam Cogan