Skip to content

Instantly share code, notes, and snippets.

@deanlandolt
Created February 11, 2010 04:38
Show Gist options
  • Save deanlandolt/301235 to your computer and use it in GitHub Desktop.
Save deanlandolt/301235 to your computer and use it in GitHub Desktop.
var MyClass = Model("MyClass",
require("store/xmldb").PropertyStore()),
{
properties: {
foo: {type: String},
bar: {type: Integer, optional: true, index: true},
baz: {type: Date, optional: true},
xml: String /*perhaps some kind of special class I can test with instanceof*/
}
}
);
PUT /MyClass/
{id: "hello", foo: "quux", xml: "<a>aaa</a>"}
GET /MyClass/hello
returns =>
{id: "hello", foo: "quux", xml: {"$ref": "#", mediaType: "text/xml"}
GET /MyClass/hello
Accept: text/xml
returns =>
Content-Type: text/xml
<a>aaa</a>
Also,
GET /MyClass/hello.xml
returns =>
Content-Type: text/xml
<a>aaa</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment