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  Express Serverless Platform 14 day free trial account.

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

Built in Walkthrough

The Express Serverless Platform 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 Express Serverless PlatformCanvas, 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

Getting Started

When you log in you will be directed to the Express Serverless Platform 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.



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.

 

Explore the Memory Connector

For most Connectors connecting a data source,  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.

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

 


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

Let’s define the context path as cars.

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.

Set the Property Name to “year”

Explore Property Types Set the Property Data Type to Number



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

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 the Function

Choose Node 8 and Click OK to deploy the Function

 



Access the Details Panel and Explore the Built-in Code Editor

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




Add a Gateway and Pipelines

Express Serverless Platform 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 the Express Serverless Platform. 

 

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.


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.



Rename the Pipeline to CarPipeline

The “CarPipeline” will already contain a Proxy policy.



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.

 



Ready, Set – Deploy the Gateway!


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. 

 

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.  

 

CarAPIEndpoint will have a path specified for invocation – “/cars*” taken from the context path Car Model



 

 



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. 

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

 

 The Path as is automatically set to /myfunction* from the function name

 

Click OK to create the MyFunction API endpoint


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

The Express Serverless Platform supports popular public and private clouds, plus new and legacy datasources. 

 
LunchBadger integrations

Free Express Serverless Platform 14 Day Trial

Learn how theExpress Serverless Platform can help you quickly deliver on an API strategy that is secure, scalable, for both developers and operations teams.