pretty
An extension to jazz up the response body by adding indentation and sorting the keys alphabetically.
import cheetah from 'https://deno.land/x/cheetah/mod.ts'
import { pretty } from 'https://deno.land/x/cheetah/ext/pretty.ts'
const app = new cheetah()
.use(pretty())
Configuration
indentSize
Apply indentation to your response body. Set it to
0
to disable indentation.pretty({ indentSize: 4 // 2 by default })
sort
Whether to sort the fields alphabetically.
pretty({ sort: true // disabled by default })
Example
Without pretty
{"lastname": "Doe","firstname": "John","data": {"height": 180,"age": 20}}
With pretty
(sorting enabled)
{
"data": {
"age": 20,
"height": 180
},
"firstname": "John",
"lastname": "Doe"
}
With pretty
(sorting disabled)
{
"lastname": "Doe",
"firstname": "John",
"data": {
"height": 180,
"age": 20
}
}