New:Microsoft Teams Notifications Are Now Available in Socket.Learn more →
Get Started

abaca-koa

Package Overview
Dependencies
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abaca-koa

Abaca Koa integrations

Source
npmnpm
Version
0.18.2
Version published
Weekly downloads
0
-100%
Maintainers
2
Weekly downloads
 
Created
Source

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 */
});

Keywords

abaca

FAQs

Package last updated on 29 Mar 2025

Related posts