2.1.2 • Published 5 years ago

roe v2.1.2

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

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

2.1.2

5 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.2.0

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

0.0.0

8 years ago