baucis-decorator-insensitive

1.0.1 • Public • Published

baucis-decorator-insensitive

Allows an insensitive query parameter and acts like a very basic auto-complete.

Install

npm install baucis-decorators baucis-decorator-insensitive --save

Usage

Just add the decorator and then suppose you have some users named "John", "joe", and "JONNY". You'd be able to GET all three of those users via /api/users?insensitive[name]=jo.

Example

controllers/Resource.js

var baucis = require('baucis');
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var ObjectId = Schema.Types.ObjectId;
 
var ResourceProps = {};
 
ResourceProps.name = {
  type: String
};
 
var ResourceSchema = new Schema(ResourceProps);
var ResourceModel = mongoose.model('Resource', ResourceSchema);
var ResourceController = baucis.rest('Resource');
 
var decorators = require('baucis-decorators');
decorators.add.call(ResourceController, [
  'baucis-decorator-insensitive'
]);
 
/**
 * Expose controller.
 */
module.exports = ResourceController;

Package Sidebar

Install

npm i baucis-decorator-insensitive

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • timbur