New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

baucis-decorator-clone

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

baucis-decorator-clone

Adds a clone method to `baucis` resources.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

baucis-decorator-clone

Adds a clone method to baucis resources.

Install

npm install baucis-decorators baucis-decorator-clone --save

Usage

This is a WIP (currently untested), so use at your own discretion. Just add the decorator and it might work. It adds a clone endpoint so that you can POST something like {"id": "123} or {"name": "timbur"} to /api/users/clone and should return a new resource based on the first match.

Example

controllers/User.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 UserProps = extend({}, ResourceProps);

UserProps.name = {
  type: String
};

var UserSchema = new Schema(UserProps);
var UserModel = mongoose.model('User', UserSchema);
var UserController = baucis.rest('User');

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

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

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

Keywords

FAQs

Package last updated on 05 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