1.2.1 • Published 5 years ago

seneca-web-adapter-koa2 v1.2.1

Weekly downloads
7
License
ISC
Repository
github
Last release
5 years ago

Seneca

seneca-web-adapter-koa2

npm version Build Status Coverage Status Dependency Status

  • Node: 6.x, 8.x
  • Seneca: 1.x - 3.x

This is an adapter for seneca-web using koa/koa-routes.

Installation

Peer dependencies have been specified for koa, koa-router and seneca-web They need to be present for this to work at all.

npm install --save koa@2
npm install --save koa-router@7
npm install --save seneca
npm install --save seneca-web
npm install --save seneca-web-adapter-koa2

Usage

Please refer to the seneca-web documentation on how to load routes.

You can require this module as the adapter when using the SenecaWeb plugin

const Seneca = require('seneca')
const SenecaWeb = require('seneca-web')
const Koa = require('koa')
const Router = require('koa-router')
const app = Koa()
const seneca = Seneca()
seneca.use(SenecaWeb, {
  context: Router(),
  adapter: require('seneca-web-adapter-koa2')
})
seneca.ready(() => {
  app.use(
    seneca
      .export('web/context')()
      .routes()
  )
})

Note

Most of the seneca-web documents refer to passing the application as the context parameter. Doing this with koa will result in unexpected explosions. Koa Router must be used.

Contributing

The Senecajs org encourage open participation. If you feel you can help in any way, be it with documentation, examples, extra testing, or new features please get in touch.

License

Copyright (c) 2016-2017, Tyler Waters. Licensed under MIT.

1.2.1

5 years ago

1.2.0

5 years ago

1.1.0

6 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

8 years ago

1.0.0

8 years ago