Home Manual Reference Source

Upgrade to V2

Koa-smart v2 is the current release and it introduces some breaking changes. The following guide lists some of the changes to upgrade from v1 to v2.

Breaking Changes

Body parametter: change params key to bodyType

Class Route: change functions

New in v2

Manage query parameters with queryType

  // call => /view?email=myemail@email.com&name=myName

  @Route.Get({
    queryType: Types.object().keys({
      email: Types.string().required(),
      name: Types.string().uppercase(),
    }),
  })
  async view(ctx) {
    this.sendCreated(ctx, this.queryParam(ctx));
  }

Add new assert functions

Automatic doc generation

Koa-smart can now automatically generate documentation, by adding the following parameter at the App's creation:

  const app = new App({
    port: 3001,
    generateDoc: true, // indicates we want koa-smart to generate documentation
  });

for more details, see the relevant documentation