0.10.11 • Published 3 months ago
abaca-koa v0.10.11
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.10.11
3 months ago
0.10.10
8 months ago
0.10.9
8 months ago
0.10.8
8 months ago
0.10.7
8 months ago
0.10.6
8 months ago
0.10.5
8 months ago
0.10.4
8 months ago
0.10.3
8 months ago
0.10.2
8 months ago
0.10.1
8 months ago
0.9.2
8 months ago
0.9.1
8 months ago
0.9.0
8 months ago
0.8.2
9 months ago
0.8.1
9 months ago
0.8.0
9 months ago
0.7.1
9 months ago
0.7.0
9 months ago
0.6.4
9 months ago
0.6.3
9 months ago
0.6.2
9 months ago
0.6.1
9 months ago
0.6.0
9 months ago
0.5.2
9 months ago
0.5.1
9 months ago
0.5.0
9 months ago
0.4.3
9 months ago