0.7.0 • Published 2 years ago
koas-operations v0.7.0
Koas Operations
Koas operations maps operation IDs to Koa controller functions.
Installation
npm install koa koas-core koas-operations
Usage
const Koa = require('koa');
const { koas } = require('koas-core');
const { operations } = require('koas-operations');
const api = require('./api.json');
const controllers = require('./controllers');
const app = new Koa();
app.use(
koas(api, [
operations({
controllers,
async fallback(ctx, next) {
// Handle operation not found
},
}),
]),
);
Options
operations
: A mapping of operation IDs to Koa middleware functions.fallback
: A fallback function. This is called if the operation object doesn’t have anoperationId
property or the operation ID doesn’t map to a function in theoperations
object.throwOnExtraneous
: Throw an error if a handler is passed that doesn’t match an operation.throwOnNotImplemented
: Throw an error if an operation hasn’t been implemented. (defaulttrue
) (defaulttrue
)
0.7.0
2 years ago
0.6.0
2 years ago
0.5.4
2 years ago
0.5.5
2 years ago
0.5.3
2 years ago
0.5.2
3 years ago
0.5.1
3 years ago
0.5.0
3 years ago
0.4.1
4 years ago
0.4.0
4 years ago
0.3.0
4 years ago
0.2.1
4 years ago
0.2.0
5 years ago
0.1.11
5 years ago
0.1.10
5 years ago
0.1.8
5 years ago
0.1.6
5 years ago
0.1.5
5 years ago
0.1.3
5 years ago
0.1.2
5 years ago
0.1.1
5 years ago
0.1.0
5 years ago