Hello World Meet RAW.

Georges Lagardère
3 min readJan 4, 2022

In this post I am going to explain how to create an “Hello world!” app in RAW. This app is a simple API endpoint which responds to an HTTP GET with the “Hello world!” JSON string:

https://api.raw-labs.com/demos/1/public/hello-world/hello-world

Before creating the actual “Hello world!” application in RAW there are some prerequisites: first you need to own accounts on raw-labs.com and GitHub.com. Then, you need to go to GitHub, install the RAW repository reader app and grant it read access to the repository where you plan to store your “Hello world” app.

Once this done, RAW will be able to synchronize in real time with the content of your repository and deploy your API endpoint according to your configuration and the code you want to run.

Typically, the minimum RAW app will contain a configuration file (.YML), a code file (.RQL) and a README.md file in a folder. Any YAML file found in a folder synchronized with RAW will become an API endpoint. In the example below, hello-world will become the endpoint as in https://somepath/api/hello-world

Typical minimum RAW app folder

RAW Labs provides developers with an extension to Visual Studio Code to facilitate app development.

The piece of code you will write implements one single function returning the “Hello World!” string.

// Hello world Example
// returns a simple string
hello_world() := {
"Hello World!"
}

And the minimal configuration file will look like the following:

raw: 0.9
endpoint: GET
metadata:
title: Hello world
description: Hello world example
tags:
- helloworld
code: rql
declaration: hello_world
codeFile: hello-world.rql
format: json
security:
public: true
computeClass: normal
enabled: true

Some fields are obvious, but a few deserve further explanations.

code: rql

This means that the code to be executed is RAW SQL.

declaration: hello_world

As explained above, the endpoint will be /hello-world but the function triggered by the HTTP GET will be hello_world as declared in the hello-world.rql file.

format: json

The output format is JSON.

security:
public: true

This endpoint is public and doesn’t require any credentials or authorizations to be executed.

computeClass: normal

RAW Labs provides three different computing classes to execute the code. They range from normal to large and extra-large. Computing classes are chosen depending on the complexity of the code and queries and the expected speed of execution. For this simple example, the normal class is the best option.

As soon as you will have committed your files to your GitHub repository the hello-world endpoint will become available and visible in the catalog.

Hello world app available in the catalog

From the RAW Admin console you will be available to check the deployment settings and monitor endpoint usage.

The complete code example is available on GitHub here.

--

--