Azure | Simple HTTP Endpoint

In this example, we deploy an HTTP Node.js Azure Function. This example shows you how to read properties off of a query string or the request body, then set a result back to Azure.

user  

Matt Hernandez

Clone This Example

Step #1 -
npm install serverless -g
Step #2 -
serverless install -u https://github.com/serverless/examples/tree/master/azure-node-simple-http-endpoint -n  azure-node-simple-http-endpoint

Simple HTTP example

In this example, we deploy an HTTP Node.js Azure Function. This sample show you how to read properties off of a query string or the request body, then set a result back to Azure.

See the Azure Functions Serverless Plugin docs for more info.

Note: you may need to change the service name in serverless.yml

Setup

  1. We recommend Node.js v6.5.0
  2. Install the serverless framework - npm install -g serverless
  3. Install the dependencies of this example - npm install

Deploying

To deploy, use the deploy and follow the instructions to log into your Azure account.

$ serverless deploy
Serverless: Packaging service...
Serverless: Logging in to Azure
Serverless: Paste this code (copied to your clipboard) into the launched browser, and complete the authentication process: BLAZSRMVJ

Once authenticated, the session will continue and deploy the app.

Invoking

Invoke the deployed function using the invoke command.

$ serverless invoke -f hello -d "{ \"name\": \"World\" }"
Serverless: Logging in to Azure
"Hello World"

Latest commit b2f54ec on Sep 24, 2017

New to serverless?

To get started, pop open your terminal & run:

npm install serverless -g