# baucis-decorator-env

> Allows properties for some resource to have an alternative `development` key when accessed via `/dev/api/etc`.

Latest version **1.0.3** (published 2015-06-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install baucis-decorator-env
pnpm add baucis-decorator-env
yarn add baucis-decorator-env
bun add baucis-decorator-env
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2015-06-24 |
| First published | 2015-06-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | timbur |
| Maintainers | timbur |
| Keywords | baucis, decorator, env, environment, development, production, resource |

## Links

- npm: https://www.npmjs.com/package/baucis-decorator-env
- Repository: https://github.com/loggur/baucis-decorator-env
- Homepage: https://github.com/loggur/baucis-decorator-env#readme
- Issues: https://github.com/loggur/baucis-decorator-env/issues
- npm.io page: https://npm.io/package/baucis-decorator-env

## Dependencies (3)

- [mongoose](https://npm.io/package/mongoose.md) >=4.0.4
- [deep-extend](https://npm.io/package/deep-extend.md) ^0.4.0
- [baucis-decorators](https://npm.io/package/baucis-decorators.md) ^1.0.0

## Alternatives

- [replicas-cli](https://npm.io/package/replicas-cli.md) — 3.0K weekly downloads
- [env-contract](https://npm.io/package/env-contract.md) — 133 weekly downloads
- [@openveo/api](https://npm.io/package/@openveo/api.md) — 61 weekly downloads
- [@ryniaubenpm2/cumque-error-reiciendis](https://npm.io/package/@ryniaubenpm2/cumque-error-reiciendis.md) — 54 weekly downloads
- [ts-global-type-extra](https://npm.io/package/ts-global-type-extra.md) — 11 weekly downloads

## Recent versions

- 1.0.3 (latest) — 2015-06-24
- 1.0.2 — 2015-06-24
- 1.0.1 — 2015-06-05
- 1.0.0 — 2015-06-03

## README

# baucis-decorator-env
Allows properties for some resource to have an alternative `development` key when accessed via `/dev/api/etc`.

## Install
```
npm install baucis-decorators baucis-decorator-env --save
```

## Usage
Add the decorator and it will add the functionality to any properties containing an `env` field set to true.  This will allow you to access the same property in two different environments - e.g., `/api/modules/123` or `/dev/api/modules/123` might return different properties with this decorator enabled.

## Example
`controllers/Module.js`
```js
var baucis = require('baucis');
var mongoose = require('mongoose');
var Schema = mongoose.Schema;

var extend = require('deep-extend');
var ResourceProps = require('../props/Resource.js');
var ResourceController = require('../controllers/Resource.js');

var ModuleProps = extend({}, ResourceProps);

ModuleProps.js = {
  type: String,
  env: true
};

var ModuleSchema = new Schema(ModuleProps);
var ModuleModel = mongoose.model('Module', ModuleSchema);
var ModuleController = baucis.rest('Module');

var decorators = require('baucis-decorators');

// decorate controller
decorators.add.call(ModuleController, [
  'baucis-decorator-env',
  ResourceController        // `ModuleController` will inherit all of `ResourceController`'s decorators
]);

/**
 * Expose controller.
 */
module.exports = ModuleController;

---
_Source: https://npm.io/package/baucis-decorator-env · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
