nlf / mudskipper

a resourceful router plugin for hapi
15 stars 3 forks source link

Should allow singular root objects #10

Open nlf opened 10 years ago

nlf commented 10 years ago

Right now the closest approximation is to override the path with a singular name and use the index method, but this fails if you want to have children on the resource.

Should look something like the following..

{
  user: {
    singular: true,
    show: function (request) { /* ... */ },
  }
}

Differing behavior is that we don't singularize the name, and index and create become invalid methods.

nlf commented 10 years ago

Just a random thought.. Might be possible to just check if the singularized form of the name is equal to the literal name rather than setting a flag manually. Not sure if I like that though.

nlf commented 10 years ago

Also should create really be invalid? Index definitely is, since show effectively becomes the index, but allowing a POST to the singular resource is probably something that should be there.