This page will walk you through creating your first serverless function with Binaris.

Note: the instructions below assume you are using MacOS, Ubuntu or Debian.

Prerequisites

The Binaris platform is currently in beta. To try out Binaris please navigate to binaris.com/try and complete the sign-up steps. At the end of the process you will receive a Binaris API Key, hold on to it for the setup steps below.

To install the Binaris CLI a minimum NodeJS version 8.0 is required.

Now launch a shell window to get started

1. Setup

The Binaris CLI is available via npm.

$ npm install -g binaris  

2. Input your API Key

$ bn login

Note: Your API Key is now stored in ~/.binaris.yml

3. Create your function

The below will create local files function.js and binaris.yml in the “hello” directory

$ mkdir hello
$ cd hello
$ bn create node8 hello
Created function hello in /hello
  (use "bn deploy hello" to deploy the function)

function.js and binaris.yml will be explained in next tutorials.

4. Deploy to Binaris

$ cd hello
$ bn deploy hello
Deployed function hello
Invoke with one of:
  "bn invoke hello"
  "curl -H X-Binaris-Api-Key:<Your_API_Key> https://run-sandbox.binaris.com/v2/run/<Your_Account_Numbrt>/hello"

5. Invoke the function

$ bn invoke hello
"Hello World!"
$ bn invoke hello --data '{ "name": "Binaris" }'
"Hello Binaris!"

6. Cleanup

Note: the next tutorial relies on the steps you’ve taken so far. If you plan to continue to the next tutorial don’t remove your function.

$ bn remove hello
Removed function hello

Tip

You can use bn --help to see all the available CLI commands.

What’s next