yefei / zenweb-helper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ZenWeb Helper module

ZenWeb

ctx.helper

query(), body(), params()

ctx.body = ctx.helper.query('kw', {
  count: 'int',
  is: 'bool',
  list:'int[]',
  trim:'trim',
  trimList:'trim[]',
  name: {
    type: 'string',
    as: 'asName',
    default: 'no name',
    validate: {
      maxLength: 100,
      minLength: 2,
    },
  },
});
curl --location --request GET '127.0.0.1:7001/typecast?kw=%20111%20&count=222&is=y&list=1,2,3&trim=%20%20aaaa%20&trimList=asd,sdd,%20%20ddd%20,d,,1'
{
  "kw": " 111 ",
  "count": 222,
  "is": true,
  "list": [
    1,
    2,
    3
  ],
  "trim": "aaaa",
  "trimList": [
    "asd",
    "sdd",
    "ddd",
    "d",
    "1"
  ],
  "asName": "no name"
}

About


Languages

Language:TypeScript 100.0%