This package has been deprecated

Author message:

use alp-params instead

alp-params-node

0.2.0 • Public • Published

alp-params-node

import Koa from 'koa';
import params from 'alp-params-node';
 
const app = new Koa();
params(app);
    index(ctx) {
        const name = ctx.params.string('name').notEmpty().value;
        ctx.body = this.t('Hello %s!', ctx.params.isValid() ? name : 'World');
    },
 
    something(ctx) {
        // throw a 404 if the param was not found
        const name = ctx.validParams.string('name').notEmpty().value;
        ctx.body = this.t('Hello %s!', name);
    },

Validator

.isValid()

.hasErrors()

.getErrors()

.string(name, position)

ValueStringValidator

.notEmpty()

Readme

Keywords

Package Sidebar

Install

npm i alp-params-node

Weekly Downloads

1

Version

0.2.0

License

ISC

Last publish

Collaborators

  • churpeau