Build an Azure Serverless Function with nodejs and test locally

Bawantha Rathnayaka
2 min readOct 15, 2022

--

In this article, I will show how to create an azure serverless function with node js and test your function locally. 🤗

Azure Function is a serverless solution that allows you to write less code, maintain less infrastructure, and save on costs. Instead of worrying about deploying and maintaining servers, the cloud infrastructure provides all the up-to-date resources needed to keep your applications running.

what will we need?

  1. Visual studio code
  2. Azure tools extension — VS Code Extension
  3. Azure function core tools — NPM Package

1. Create a function app using vs code extension

first, click the azure tool extension icon in the left sidebar and click + icon on the workspace tab and select create function

after that, you will get to select a template for your function. today we will create an HTTP trigger function

you can learn other types of function please refer this link

Your final code will look like this.

2. Run your function

after that you can test your function locally without an azure account

type npm run start in your vs code terminal and you will get a URL to test your function in your local machine.

you can test your function in a postman application like that

Tadaaaa 🥳 your first azure serverless function is up and running.

--

--

Bawantha Rathnayaka

I write about my experiences as a Software Engineer and the tech I use daily. portfolio - https://bawanthathilan.vercel.app/