Response: Response
string will be send to client with content-type text/html
$app->post('/test', function() {
return "<pre>".var_export($this->body);
});
array will be encoded and send to client with content-type application/json
$app->set('pretty'); // pretty print
$app->post('/test', function() {
return $this->body;
});
int will be send as http status
$app->post('/test', function() {
return 201;
});
and a little hack
$app->post('/resource', function() {
return [201, 'resource created', 'X-HEADER' => 'foo'];
});