bragg-env

2.0.0 • Public • Published

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

Package Sidebar

Install

npm i bragg-env

Weekly Downloads

2,645

Version

2.0.0

License

MIT

Last publish

Collaborators

  • samverschueren