National Puppy Menace

    koa-autowire

    1.1.4 • Public • Published

    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)

    Install

    npm i koa-autowire

    DownloadsWeekly Downloads

    2

    Version

    1.1.4

    License

    MIT

    Unpacked Size

    193 kB

    Total Files

    9

    Last publish

    Collaborators

    • matsp