Getting Up and Running

Build an entire microservice based application in just two minutes!

For this helpful, easy-to-follow guide, you will need a LunchBadger 14 day free trial account.

Once you register for an account and activate your email, you will be directed to the LunchBadger Canvas.

Built in Walkthrough

The LunchBadger Canvas has a built in walkthrough with easy-to-use prompts that take you through the following steps: how to create a microservice, deploy and configure an API Gateway, connect a microservice to the API Gateway, and expose it as an API Endpoints. Then, you’ll trace your API workflow from public API Endpoints to your in-memory data source. If you have any questions or get stuck, hit us up at [email protected]

Quickstart

Quickstart

After you log in to the LunchBadger Canvas, you can build a microservices application in two minutes by following the built-in walkthrough. 

What we’ll be doing:

  1. Deploy and use an Memory Connector to connect to an in-memory database
  2. Create and deploy a “Car” that will be a Model based microservice
  3. Connect the Car Model to the Memory Connector to read and write Car data
  4. Deploy and configure an API Gateway – an instance of Express Gateway
  5. Connect the Car Model to the API Gateway
  6. Expose the Car Model microservice as a Car API Endpoint that we can call through an API Request using cURL
  7. Deploy a Function called MyFunction that will be a “serverless” Function based microservice
  8. Connect the MyFunction Function to the API Gateway
  9. Expose the MyFunction microservice as a MyFunction API Endpoint that we can call through an API Request using cURL

Navigating the Entity Palette in LunchBadger

Getting Started

When you log in you will be directed to the LunchBadger Canvas.  Think of the Canvas as a “single pane of glass” that visualizes all of the moving parts in your microservices application. 

 

The Canvas is broken up into a few easy parts: Entity Palette, Quadrants and Panels.

 

Navigate to the Entity Palette to access a collection of Connectors.

Connector Entities Overview in LunchBadger

Add a Memory Connector

Access a collection of Connectors in the Entity Palette through the Connectors Submenu.

 

Choose the Memory Connector from the Data Source Entities Menu to add it to your project on the LunchBadger Canvas.

 

Connectors are pre-built libraries that allow you to utilize popular data sources and services. Each Data Source comes with it’s own set of properties.

 

Unlike other connectors, the Memory Connector acts as its own in-memory database and is perfect for getting our project started quickly.

 

Creating a Memory Connector in LunchBadger

Explore the Memory Connector

For most Connectors connecting a data soruce,  you would specify the data source properties such as host or port.

 

Because the Memory Connector acts as its own in-memory database, you do not need to specify those properties at this time.

Model Entities Overview in LunchBadger

Add a Model Entity and Define a Model name

Navigate to Model Entity on the Entity Palette.

 

Add a Model Entity. 

 

There are a few important things you should know about a Model. All Models are Node.js JavaScript functions. Models have the following basic built in functionality to save you time:

 

  • Properties
  • Read and or Write data through Connectors (CRUD)
  • Dynamically built REST representation on the Model’s definition

 

Create a Model Entity Context Path in LunchBadger

Let’s name the Model Car and Define the Context Path

Let’s define the context path as cars.

Define Model Entity Properties in LunchBadger

Add Properties You Want to Expose

You’ve create the Model and defined the context path.

 

Now, click the plus icon to add properties you would like to expose from your data to your API Endpoint.

Add a Property to your Model Entity in LunchBadger

Set the Property Name to “year”

Set the Property Type to Number in the Model Entity

Explore Property Types Set the Property Data Type to Number

Connect the Connector to the Model in LunchBadger

Connect the Car Model to the Memory Connector

Wiring up Entities in LunchBadger is as easy as dragging a connection from one entity to another.

 

Activate the connection by clicking on the port.

 

Drag and drop the connection to the from your Memory Connector port to the port on your Car Model.

 

The Car Model can now store its data in the in-memory database through the Memory Connector.

Add a Function in LunchBadger

Add a Function

Deploy a Function called “MyFunction” in just a few easy steps.

 

This Function comes with default function code to return the string “LunchBadger Function” when it’s run in your Kubernetes cluster.

 

Functions are “serverless” pieces of code that can be written in any number of languages including:

 

  • Node.js
  • Python
  • Go
  • Ruby
  • PHP
  • Java
  • .NET Core

 

Functions are similar to Models. Both entities are programming functions,  but Functions are completely barebone and do not have any built in functionality.

 

Navigate to Function Entity in the Entity Palette.

Deploy a Function in LunchBadger

Choose a Runtime and Deploy the Function

Choose a RunTime.

 

Currently Node 8 and Python 2.7 are available in the LunchBadger canvas.

 

Explore the Function Entity's Built in Editor in LunchBadger

Access the Details Panel  and Explore LunchBadger’s Built-in Editor

Now that the Function is deployed, you can explore more details about the Function by clicking on the details icon to access LunchBadger’s built-in editor.

Add a Gateway and Pipelines in LunchBadger

Add a Gateway and Pipelines

LunchBadger Canvas uses an API Gateway to expose your microservices (models, functions, service endpoints etc) as HTTP based APIs. Gateways secure and manage the APIs through a set of policies like authorization, authentication, rate limiting and other quality of service functionality. 

 

We use Express Gateway, an open source API Gateway, as our API Gateway in LunchBadger. 

 

Navigate to Gateway Entity in the Entity Palette.

 

Add the Gateway to your project by clicking on the Gateway icon. We’ll customize it in the next step.

Configure Pipelines in the Gateway Entity

Hover over Pipeline to Begin Configuration

The Gateway is made of Pipelines, a collection of policies that are invoked when an API Endpoint is called

 

You can use Pipelines to connect a microservice to a corresponding API Endpoint. Data will flow through a Pipeline in the Gateway to ensure Policies (i.e., authentication/authorization) are enforced.

Name the Pipeline in the Gateway Entity in LunchBadger

Rename the Pipeline to CarPipeline

The “CarPipeline” will already contain a Proxy policy.

Add a Second Pipeline in the Gateway in LunchBadger

Add Another Pipeline and Name it FunctionPipeline

You can configure a unique set of policies to handle different sets of API Endpoints for each Pipeline. For more complex applications you can add as many Pipelines as needed to be able to handle each set of API Endpoints.

 

The “FunctionPipeline” will also contain its own Proxy policy.

 

Deploy an API Gateway in LunchBadger

Ready, Set – Deploy the Gateway!

Connect Car Model with CarPipeline in LunchBadger

Connect the Car Model to the CarPipeline in the Gateway

Wiring up microservices to the Gateway is as simple as drawing a connection from the microservice entity’s right port to the Pipeline’s left port. 

 

Activate the connection by clicking on the port.

 

Drag and drop the connection to the from your Car Model port to the CarPipeline port in the Gateway.

 

The Car Model can now connect to API Endpoints through CarPipeline and Policies in the Gateway. 

 

An API Endpoint is automatically created in LunchBadger

API Endpoints are Automatically Generated

A corresponding API Endpoint is automatically generated when you connect a microservice entity to the Gateway’s Pipeline for the first time.

 

Rename the exposed API Endpoint to CarAPIEndpoint.  

 

Configure this API Endpoint by adding a Path

CarAPIEndpoint will have a path specified for invocation – “/cars*”

Connect the Function to the FunctionPipeline in the Gateway in LunchBadger

Connect the Function to the FunctionPipeline in the Gateway

Connect the Function to the Gateway via the FunctionPipeline to expose the Function as an API Endpoint

 

Activate the connection by clicking on the port.

 

Drag and drop the connection to the from MyFunction port to the FunctionPipeline port in the Gateway.

 

The Function can now connect to API Endpoints through FunctionPipeline and Policies in the Gateway. 

MyFunctionAPIEndpoint is automatically created. Configure this API Endpoint by adding a Path

Just like when we created the CarPipeline, a corresponding API Endpoint is automatically generated and pre-connected to the FunctionPipeline.

 

 Set the Path as /myfunction*

Submit MyFunctionAPIEndpoint. Voila!

Let’s Try It!

With a few clicks, you’ve created two sets of microservices, Car Model and MyFunction

 

The Car Model, is a Model with built-in CRUD functionality (through Connectors) and a rich REST API automatically generated for you. 

 

MyFunction, is a serverless Function that you can write in a number of languages and invoke through the API Gateway.

 

Both microservices are exposed and ready to be invoked with their own API Endpoints . 

 

curl https://<root url>/api/cars

and

 

curl https://<root url>/api/myfunction

Supported Integrations

LunchBadger supports popular public and private clouds, plus new and legacy datasources. 

 
LunchBadger integrations

Free LunchBadger 14 Day Trial

Learn how the LunchBadger platform can help you

quickly deliver on an API strategy that is secure, scalable,

for both developers and operations teams.