seneca-web-adapter-express

1.2.1 • Public • Published

Seneca

seneca-web-adapter-express

npm version Build Status Coverage Status Dependency Status

This is an adapter for seneca-web using express.

Installation

A peer dependency has been specified for seneca-web And of course express must be present for this to work at all.

npm install --save express
npm install --save seneca-web
npm install --save seneca-web-adapter-express

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 Express = require('express')
const seneca = Seneca()
seneca.use(SenecaWeb, {
  context: Express(),
  adapter: require('seneca-web-adapter-express'),
  // defaults --
  options: {
    parseBody: true,
    includeRequest: true,
    includeResponse: true
  }
})
seneca.ready(() => {
  const app = seneca.export('web/context')()
  app.listen(3000)
})

Additional Options

  • parseBody attempt to parse request body into req.body
  • includeRequest include request$ with payload (req)
  • includeResponse include response$ with payload (res)

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) 2013 - 2017, Richard Rodger and other contributors. Licensed under MIT.

/seneca-web-adapter-express/

    Package Sidebar

    Install

    npm i seneca-web-adapter-express

    Weekly Downloads

    178

    Version

    1.2.1

    License

    MIT

    Unpacked Size

    12.3 kB

    Total Files

    6

    Last publish

    Collaborators

    • davidmarkclements
    • mcdonnelldean
    • mihaidma
    • rjrodger
    • tswaters
    • wyatt