servant/example/greet.md
Christian Marie aa64d7a0bf Add DocIntro and DocNote types to allow extra docs
This commit provides a way for a user to add information to either the
beginning of the output, and for a HasDoc instance to add extra sections to an
endpoint.

See example/greet.hs for usage of the Intro type.
2015-01-23 14:31:45 +11:00

1.1 KiB

On proper introductions.

Hello there.

As documentation is usually written for humans, it's often useful to introduce concepts with a few words.

This title is below the last

You'll also note that multiple intros are possible.

POST /greet

Request Body:

{
    "msg": "Hello, haskeller!"
}

Response:

  • Status code 201
  • If you use ?capital=true
{
    "msg": "HELLO, HASKELLER"
}
  • If you use ?capital=false
{
    "msg": "Hello, haskeller"
}

GET /hello/:name

Captures:

  • name: name of the person to greet

GET Parameters:

  • capital
    • Values: true, false
    • Description: Get the greeting message in uppercase (true) or not (false). Default is false.

Response:

  • Status code 200
  • If you use ?capital=true
{
    "msg": "HELLO, HASKELLER"
}
  • If you use ?capital=false
{
    "msg": "Hello, haskeller"
}

DELETE /greet/:greetid

Captures:

  • greetid: identifier of the greet msg to remove

Response:

  • Status code 204
  • No response body