Recipes
HTTP methods
Specify an HTTP method in the manifest request block. For example, create a route to handle the POST method. Here is an example:
The following methods are supported:
GET
HEAD
POST
PUT
PATCH
DELETE
OPTIONS
TRACE
Path variables
A braced string in the manifest request block is treated as a path variable. For example, create /users/{userId}
for handling /users/1
, /users/2
and so on. Here is an example:
Response header
You can set pairs of key and value to the headers. The value should preferably be a string (an integer is allowed) and can be parsed as a pattern (see also the later section).
You can set multiple values.
Response body
You can serve a text body as follows:
You can serve a JSON body as follows:
If a character set is specified in the content-type
header, the response body is encoded to the character set.
Files
You can serve a file content as follows:
You can store the larger response bodies in a separate file.
Last updated