Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A tiny resources library for picard
JavaScript Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
sample_app
README.mdown
picard-resources.js

README.mdown

Picard Resources

Inspired by http://github.com/nateware/sinatra-resources

  1. You'll need my fork of picard (until it hopefully gets pulled)
  2. export NODE_PATH=/path/to/picard/lib
  3. node sample_app/node.js

And behold:

resource("projects", function() {

  // GET: /projects
  this.get(function() {
    return {text: "Projects"}
  })

  // POST: /projects
  this.post(function() {
    return {text: "POST Projects"}
  })

  this.member(":project_id", function() {

    // GET: /projects/1
    this.get(function(params) {
      return {text: "GET Project No. " + params.project_id}
    })

    // PUT: /projects/1
    this.put(function(params) {
      return {text: "PUT Project No. " + params.project_id}
    })

    // DELETE: /projects/1
    this.del(function(params) {
      return {text: "DELETE Project No. " + params.project_id}
    })

  })
})

Check out specs in sample_app/spec for more details.

Something went wrong with that request. Please try again.