Package Exports
- koa-api-framework
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (koa-api-framework) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
koa-api-framework
An API framework using Koa. This will build an API framework based off a RAML 0.8 file, applying any JSON schemas on incoming data to make validation simpler.
Necessary files
/raml/api.raml - the RAML specification for the API /controllers/ - controllers based off the api structure. Eg an api structure of https://api.foo.com/v2/auth will require /controllers/auth/index.js
Usage
var KoaApiFramework = require('koa-api-framework');
// set up the framework
var framework = new KoaApiFramework({
debug: false,
tls: true,
tlsKeyPath: '/path/to/tls/key/server.key',
tlsCertPath: '/path/to/tls/cert/server.crt',
port: 443,
apiBase: 'https://api.foo.com/v2',
// pass in any models to make them easy to use
models: {
auth: auth,
person: person,
group: group
},
// koa-api-framework will automatically decode Authorization: Bearer [jwt] for you
jwtSecret: 'qwertyuiopasdfghjklzxcvbnm123456'
});