Function as Service — With Azure Function

This is the next article in my function-getting-started series, which aims to see which platform is quickest to move to in term of development effort

See my previous article with Google Function here

This time will be about Azure function.

azure-documentation

azure-documentation

Same target as previous post, I want to quickly build up an API endpoint (HTTP trigger function) with will return a list of news sources

It will look like this as the result:

news-sources-result

news-sources-result

 Now, let create our first function

Search for function in the dashboard

Search for function in the dashboard

Create new function

Create new function

Add detail for function

Add detail for function

Azure function supports different scenarios to trigger and different languages. We’ll go with API/Webhook call and Javascript.

Selection function template (language and trigger type)

Selection function template (language and trigger type)

Now, let add up the content of our function to return what we want

Code for index.js

Code for index.js

Then hit Save → Run

We can retrieve the URL for our function from “Get function URL” label above

Get function URL

Get function URL

Let’s try to call the function from POSTMAN client

POSTMAN result

POSTMAN result

Yay! we got our function now working as expected. Ready to scale and add more feature!

Originally published at https://medium.com/@toantran/trying-out-function-as-a-service-with-azure-function-ca7b86b74e4f

5 (100%) 2 votes