Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

azure-function-express

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

azure-function-express

Allows Express usage with Azure Function

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
272
decreased by-50.64%
Maintainers
1
Weekly downloads
 
Created
Source

azure-function-express

Function logo

Allows Express usage with Azure Function

npm version Travis Status Coverage Status MIT licensed

Description

Connect your Express application to an Azure Function handler, and make seamless usage of all middlewares you are already familiar with.

Usage

In your index.js:

const createAzureFunctionHandler = require("azure-function-express").createAzureFunctionHandler;
const express = require("express");

// Create express app as usual
const app = express();
app.get("/api/:foo/:bar", (req, res) => {
  res.json({
    foo  : req.params.foo,
    bar  : req.params.bar
  });
});

// Binds the express app to an Azure Function handler
module.exports = createAzureFunctionHandler(app);

Make sure you are binding req and res in your function.json:

{
  "bindings": [{
    "authLevel" : "anonymous",
    "type"      : "httpTrigger",
    "direction" : "in",
    "name"      : "req",
    "route"     : "foo/{bar}/{id}"
  }, {
    "type"      : "http",
    "direction" : "out",
    "name"      : "res"
  }]
}

You can have a single function.json that matches all HTTP routes with binding "route": "{*segments}". And let Express handles routing.

All examples here.

License

Apache 2.0 © Yves Merlicco

Keywords

FAQs

Package last updated on 24 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc