roe

2.1.2 • Public • Published

Build Status Coverage

roe

A single and simplified instance of Egg web framework without clusters and agents, which is more suitable for container-based deployment, such as Docker and Kubernetes.

Install

$ npm i roe

Usage

The usage of roe is much the same as egg, and you can dive into the reference of egg directly.

In addition, roe constructor accepts options.config as the server configuration, instead of by hardcoding all configurations of different environments in the local project which is an ANTI-PATTERN for ops.

A better practice is to use Kubernetes configmaps and secrets to populate them into process.envs.

const {Roe} = require('roe')
 
const app = new Roe({
  baseDir: '/path/to',
 
  // We can define roe configurations directly
  //   by passing options.config, which is a good practise
  //   for k8s based environment variables management
  config: {
    keys: process.env.SECRET_KEY,
    middleware: [
      'body-parser'
    ]
  }
})
 
app.ready(() => {
  app.listen(8888)
})

Or starting with vanilla nodejs http server

require('http')
.createServer(app.callback())
.listen(8888)

new Roe(options)

  • options Object
    • config Object | Function(appInfo) similar as config/config.default.js of egg

    • extends Object which will be Object.assign() into the instance before loaders are invoked.

    • ...others Object other options of EggCore except options.plugins

    • plugins since 2.0.0, plugins should be defined in options.config

Creates a roe instance.

License

MIT

Package Sidebar

Install

npm i roe

Weekly Downloads

4

Version

2.1.2

License

MIT

Unpacked Size

10.1 kB

Total Files

8

Last publish

Collaborators

  • kael