@christopheranderson-personal/azure-functions-typescript-project

Decorator based project for Azure Functions in TypeScript

Usage no npm install needed!

<script type="module">
  import christopherandersonPersonalAzureFunctionsTypescriptProject from 'https://cdn.skypack.dev/@christopheranderson-personal/azure-functions-typescript-project';
</script>

README

Azure Functions TypeScript Project

Define your Functions and their configuration entirely in a single library.

import { Binding, FunctionHost, Fx, HttpTrigger, HttpTriggerBinding, IBinding, IFunctionConfig, } from "azure-functions-typescript-project";

class MyFunc {
    private myhttp(context: Context, @HttpTrigger("req") req: any) {
        context.log("I'm an http function");
        context.done();
    }
}

const host: FunctionHost = new FunctionHost();
host.register(MyFunc);

export default host;

Getting started

  • package.json
{
  "dev-dependencies":{
    "azure-functions-typescript-project":"*"
  },
  "script":"aft build ."
}
  • index.ts
import { Binding, FunctionHost, Fx, HttpTrigger, HttpTriggerBinding, IBinding, IFunctionConfig, } from "azure-functions-typescript-project";

class MyFunc {
    private myhttp(context: Context, @HttpTrigger("req") req: any) {
        context.log("I'm an http function");
        context.done();
    }

    @Fx({
        excluded: true,
        bindings: [{
            name: "item",
            type: "queueTrigger",
            direction: "in",
            connection: "AzureWebJobsStorage",
        }],
    })
    private foobar(context: Context) {
        context.log("foobar");
        context.done();
    }
}

const host: FunctionHost = new FunctionHost();
host.register(MyFunc);

export default host;

License

MIT