# Simple REST Server

In this tutorial, we will build a an incredibly simple [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) Server. GreenLightning is built with REST as a first-class feature; this guide will demonstrate how quickly you can build a simple API that's performant and robust.

## Hello World Server

For our tutorial, we will build a very simple API to post to and receive messages back.&#x20;

We want to develop a server that can do the following:

* Allow someone to send a GET request with their name in the query and receive a response
* Post a JSON message to an endpoint and receive a modified response

For the sake of simplicity, this project lacks authentication or even proper validation. In a real application, you definitely don't want this.

Let's see what our 2 simple endpoints will look like:

## Say Hello

<mark style="color:blue;">`GET`</mark> `http://localhost/api/hello/${NAME}`

Returns a plaintext message containing the name.

#### Path Parameters

| Name | Type   | Description          |
| ---- | ------ | -------------------- |
| name | string | Name to be returned. |

{% tabs %}
{% tab title="200 Successful response." %}
{% code title="Response" %}

```
Hello World, ${NAME}!
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Post Information About Yourself

<mark style="color:green;">`POST`</mark> `http://localhost/api/about`

Returns a JSON message with the posted JSON slightly modified. \
Below in the request tab, the parameters should be formatted as JSON as demonstrated in the response.

#### Request Body

| Name  | Type    | Description |
| ----- | ------- | ----------- |
| Money | string  | JSON key    |
| Age   | integer | JSON key    |
| Name  | string  | JSON key    |

{% tabs %}
{% tab title="200 Successful response." %}
{% code title="Response" %}

```javascript
{
    "msg": "We made Tobi 10 years older and $5000 richer.",
    "money": 6000,
    "age": 30,
    "name": "Tobi",
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

Seems simple enough, right? On the next page, you will learn how to setup your project.
