Sleepy works with your existing codebase. Even if you're writing new code from scratch, it's good practice to separate
your API code from your routing code. The only requirement for Sleepy is that a method must have at least one argument -
a callback function that accepts a JSON object.

Sleepy assumes that your methods have the arguments named in your paths (both implictly and explicitly). For instance, in the example above, removePillow is expected to have arguments named 'bed_id' and 'pillow_id'. If the arguments are not found, they're passed as null. If you use CoffeeScript's { @bed_id, @pillow_id } notation, Sleepy will pass your arguments without a hitch.

For security purposes, query arguments must be explicitly stated in your path:

search: path: 'search?:query', method: searchBeds # GET /beds/search

In create and update actions (as well as post and put), Sleepy will pass the body of the request as an argument with a singular resource name (in our example, 'bed').

Overriding Sleepy's implicit mapping is easy. For instance, if the getBed method expects a bedId argument: