koa-autowire
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 objectconst server =key: // your ssl private key,cert: // your ssl certificate,httpPort: 80 // on this port koa will accept httphttpsPort: 443 // on this port koa will accept httpsconst koa =middlewares:customName:package: '' // any koa middlewareoptions: // constructor optionsconst endpoints =customName:method: '' // route endpoint method --> post, get, put, deleteroute: '' // route pathmiddlewares: // middleware functions that will be used
Usage
Start app
const config = const server = const app = serverserverstartapp;
Stop app
server