bragg-env

Environment middleware for bragg

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
bragg-env
2.0.05 years ago7 years agoMinified + gzip package size for bragg-env in KB

Readme

bragg-env Build Status
Environment middleware for bragg.

Install

$ npm install --save bragg-env

Usage

const app = require('bragg')();
const environment = require('bragg-env');

app.use(environment());
app.use(ctx => {
    console.log(ctx.env);
    //=> 'staging'
});

You can use the NODE_ENV environment variable to overwrite the context environment.
process.env.NODE_ENV = 'test';

app.use(environment());
app.use(ctx => {
    console.log(ctx.env);
    //=> 'test'
});

API

environment(options)

Exposes the environment in the env property of the context object.

options

Type: object
Default: {$LATEST: 'development', default: 'production'}
An aws-lamba-env options object.

Related

License

MIT © Sam Verschueren