Deno for Azure Functions

Deno for Azure Functions

This is a worker that lets you run Deno on Azure Functions. It is implemented as an Azure Functions Custom Handler and runs on the Azure Functions Consumption (serverless) plan.The project includes a CLI `denofunc` to make it easy to create, run, and deploy your Deno Azure Functions apps

Deno for Azure Functions

Overview

This is a worker that lets you run Deno on Azure Functions. It is implemented as an Azure Functions Custom Handler and runs on the Azure Functions Consumption (serverless) plan.

The project includes a CLI denofunc to make it easy to create, run, and deploy your Deno Azure Functions apps.

3 commands to get started

# initialize function app
denofunc init

# run function app locally
denofunc start

# deploy the app
denofunc publish $functionAppName

For more information, try the quickstart below.

Programming model

All Azure Functions triggers and bindings (including custom bindings) are supported.

In this simplified programming model, each function is a single file. Here are a couple of examples:

Check out the new project template for the entire app structure.

Getting started - building a Deno function app

Requirements

Codespaces

You can also get a preconfigured, cloud-based dev environment from Codespaces:

Install the denofunc CLI

To help create, run, and deploy a Deno for Azure Functions app, you need to install the denofunc CLI. denofunc wraps the Azure Functions Core Tools (func) and is used for generating artifacts required to run/deploy the app.

To install the CLI, run the following Deno command.

deno install --allow-run --allow-read --allow-write --allow-net --unstable --force \
    --name=denofunc https://raw.githubusercontent.com/anthonychu/azure-functions-deno-worker/v0.5.0/denofunc.ts

Confirm it is installed correctly:

denofunc --help

Create and run an app locally

  1. Create and change into an empty folder.

  2. Initialize the project:

    denofunc init

    A few of the files that are important to know about:

  3. Run the app locally:

    denofunc start

    The Azure Functions Core Tools (func) is then called to run the function app.

    Note: A folder is automatically generated for the hello_world function containing a file named function.json that is used by the Azure Functions runtime to load the function (they are ignored in .gitnore).

  4. Open the URL displayed on the screen (http://localhost:7071/api/hello_world) to run the function.

  5. Ctrl-C to stop the app.

Deploy the app to Azure

Now that you've run the function app locally, it's time to deploy it to Azure!

  1. Configure some variables (examples are in bash):

    region=centralus # any region where Linux Azure Functions are available
    resourceGroupName=<resource_group_name>
    functionAppName=<function_app_name>
    storageName=<storage_name> # must be between 3 and 24 characters in length and may contain numbers and lowercase letters only.
  2. If you are not authenticated with the Azure CLI, log in.

    # Log in to the Azure CLI
    az login

    This might not work in some environments (e.g. Codespaces). Try az login --use-device-code instead.

  3. Run these Azure CLI commands to create and configure the function app:

    # Create resource group
    az group create -l $region -n $resourceGroupName
    
    # Create storage account needed by function app
    az storage account create -n $storageName -l $region -g $resourceGroupName --sku Standard_LRS
    
    # Create function app (also works on Windows)
    az functionapp create -n $functionAppName --storage-account $storageName \
        --consumption-plan-location $region -g $resourceGroupName \
        --functions-version 3 --runtime dotnet --os-type Linux
  4. Deploy the app:

    denofunc publish $functionAppName

    Prior to deployment, denofunc tool will download the Deno Linux binary matching your locally installed version of deno that is included with the deployment package.

  5. The deployment output will print out the URL of the deployed function. Open to the URL to run your function.

๐ŸŽ‰ Congratulations!

You've deployed your first Azure Functions app in Deno! ๐Ÿฆ•

Download Details:

Author: anthonychu

Source Code: https://github.com/anthonychu/azure-functions-deno-worker

deno nodejs node javascript

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

AEM Querybuilder for JavaScript (Browser, Node, Deno)

Helix Querybuilder .AEM Querybuilder for JavaScript (Browser, Node, Deno)

NKeys for JavaScript - Node.js, Browsers, and Deno

A public-key signature system based on Ed25519 for the NATS ecosystem system for JavaScript. The nkeys.js library works in Deno, Node.js, and the browser!

Javascript module for easily generating mazes,compatible with both Deno and Node

A work-in-progress Javascript maze generator module, compatible with both Deno and Node.

Deno Tutorial for Beginners: Deno vs. Node: Better Than NodeJS?

Deno is released, itโ€™s time to find out if it can prove a worthy competition for Node.js. What is Deno? Why Deno can be considered an alternative to Node? The main differences between Deno and Node. Write a simple Deno app.

What is Deno? The Node.JS Killer? The Deno-minator to Node?

What is Deno? The Node.JS Killer? The Deno-minator to Node? Deno is the new hype and will it be better than node.js? Deno is a secure runtime for JavaScript and TypeScript that is based on the V8 JavaScript engine and the Rust programming language that addresses Nodeโ€™s shortcomings