Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including baucis-decorator-insensitive with all npm packages installed. Try it out:

var baucisDecoratorInsensitive = require("baucis-decorator-insensitive")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

baucis-decorator-insensitive v1.0.1

Allows an `insensitive` query parameter.

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;
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free