Package Exports
- baucis-decorator-insensitive
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (baucis-decorator-insensitive) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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;