koa-query-pretty
Pretty query middleware for koa.
Description
Koa
usesqueryString
to parse the GET
parameter by default, but the parsed arguments arestring
.
Koa-query-pretty
can be converted to concrete types like int
, float
,boolean
, null
, undefined
.
install
yarn add koa-query-pretty
use
const Koa = ;const queryPretty = ; const app = ;app;
effect
/home?id=1&name=jack&enable=true&money=2.5&hobby=1&hobby=2
result
ctx.query:
configuration
override
Overwrite the ctx.query
parameter, defaulttrue
, otherwise use ctx.prettyQuery
to get
app; app;