Edit on github

#HTTP Trigger

Azure Functions has an API endpoint created for each Function App. This service allows you to define public HTTP endpoints for your serverless functions.

To create HTTP endpoints as Event sources for your Azure Functions, use the Serverless Framework's easy HTTP Events syntax.

It might be helpful to read the Azure Function HTTP Trigger docs to learn the full functionality.

#HTTP Trigger Events

#Simple HTTP Endpoint

This setup specifies that the hello function should be run when someone accesses the Function App at api/example/hello via a GET request.

Here's an example:

# serverless.yml

    handler: handler.hello
      - http: true
            name: req #<string>, default - "req", specifies which name it's available on `context.bindings`
            methods: #<array> [GET, POST, PUT, DELETE], default - all
                - GET
            route: example/hello #<string>, default - <function name>
            authLevel: anonymous #<enum - anonymous|function (default)|admin>

URL paths for the serverless functions are prefixed with "api" by default, e.g. /api/some/path. You can change this via a setting in host.json.

// handler.js

'use strict';

module.exports.hello = function(context, req) {
  context.res = {
      body: "Hello world!"

#Request event

You can see the full docs for HTTP triggers to learn all the capabilities.

In Node.js, the request object looks like an express request object.

// handler.js

'use strict';

module.exports.hello = function(context, req) {
  const query = req.query; // dictionary of query strings
  const body = req.body; // Parsed body based on content-type
  const method = req.method; // HTTP Method (GET, POST, PUT, etc.)
  const originalUrl = req.originalUrl; // Original URL of the request - https://myapp.azurewebsites.net/api/foo?code=sc8Rj2a7J
  const headers = req.headers; // dictionary of headers
  const params = req.params; // dictionary of params from URL
  const rawBody = req.rawBody; // unparsed body

  context.res = {
      body: {

Note, if you specify WebHook, you'll get passed the body as the second argument to your Function, not the request object. You can still access the request object on the context object (i.e. context.req)

#CORS Support

You can set up CORS following the instructions on azure.com.