Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

baucis-decorator-env

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

baucis-decorator-env

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

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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

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;

Keywords

FAQs

Package last updated on 24 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc