1.1.4 • Published 5 years ago

koa-autowire v1.1.4

Weekly downloads
18
License
MIT
Repository
github
Last release
5 years ago

koa-autowire

npm npm

npm version Build Status Greenkeeper badge

Installation

npm install koa-autowire

or

yarn add koa-autowire

Configuration

you need to pass a config file or object which include the following named exports or keys:

const db = {
  // should be your db instance which will be referenced in koa context object
}
const server = {
  key: // your ssl private key,
  cert: // your ssl certificate,
  httpPort: 80, // on this port koa will accept http
  httpsPort: 443 // on this port koa will accept https
}
const koa = {
  middlewares: {
    customName: {
      package: '', // any koa middleware
      options: [] // constructor options
    }
  }
}
const endpoints = {
  customName: {
    method: '', // route endpoint method --> post, get, put, delete
    route: '', // route path
    middlewares: [] // middleware functions that will be used
  }
}

Usage

Start app

const config = require('./config.js')
const server = require('koa-autowire')

const app = server.autowire(config)
server.start(app);

Stop app

server.stop(app)
1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

6 years ago

1.1.0

6 years ago

1.0.2

6 years ago

1.0.1

7 years ago