0.18.0 • Published 9 months ago

abaca-koa v0.18.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
9 months ago

Abaca Koa integrations

Type-safe routing

import {createOperationsRouter} from 'abaca-koa';

import {Schema} from './sdk.gen.js'; // Abaca generated SDK

const pets: Schema<'Pet'>[] = [];

const router = createOperationsRouter({
  document, // OpenAPI specification
  handlers: {
    createPet: (ctx) => {
      pets.push({id: pets.length, ...ctx.request.body}); // Body is typed
      return 201; // Response code is type-checked
    },
    listPets: async (ctx) => {
      const limit = ctx.params.limit ?? 5; // Parameters are typed
      return {data: pets.slice(0, limit)}; // Response data is type-checked
    },
  },
});

Customizable proxying

import {createOperationsProxy} from 'abaca-koa';

const proxy = createOperationsProxy({
  document, // OpenAPI specification
  upstreams: {
    readOnly: {target: /* server address */},
    // Other upstreams...
  },
  dispatch: (op) => /* upstream for each operation */
});
0.17.2

9 months ago

0.18.0

9 months ago

0.17.1

9 months ago

0.16.0

12 months ago

0.15.1

12 months ago

0.17.0

12 months ago

0.12.0

1 year ago

0.13.0

1 year ago

0.14.0

1 year ago

0.15.0

1 year ago

0.14.1

1 year ago

0.11.1

1 year ago

0.11.0

1 year ago

0.10.13

1 year ago

0.10.11

2 years ago

0.10.10

2 years ago

0.10.9

2 years ago

0.10.8

2 years ago

0.10.7

2 years ago

0.10.6

2 years ago

0.10.5

2 years ago

0.10.4

2 years ago

0.10.3

2 years ago

0.10.2

2 years ago

0.10.1

2 years ago

0.9.2

2 years ago

0.9.1

2 years ago

0.9.0

2 years ago

0.8.2

2 years ago

0.8.1

2 years ago

0.8.0

2 years ago

0.7.1

2 years ago

0.7.0

2 years ago

0.6.4

2 years ago

0.6.3

2 years ago

0.6.2

2 years ago

0.6.1

2 years ago

0.6.0

2 years ago

0.5.2

2 years ago

0.5.1

2 years ago

0.5.0

2 years ago

0.4.3

2 years ago