Hi All,
As you know, when creating a resource in the domain named, say "people" you get the following behaviour:
- GET /people returns a collection
- POST /people adds to the collection
- GET /people/{id} returns a single resource.
What I want to do is create a resource named, say "foobar" that is not a collection, such that:
- GET /foobar will return a single resource (e.g. {"foo":true, "bar": false} )
- PUT /foobar will upsert the one and only foobar resource.
Something like this:
DOMAIN = {
'people': {
'schema': {'firstName': {'type': 'string'}, 'lastName': {'type': 'string'}}
},
'foobar': {
'schema': {'foo': {'type': 'boolean'}, 'bar': {'type': 'boolean'}},
'singleton': True
}
}
What I've done for now is create flask routes for GET and PUT, but I have to hand-code all of the automatic goodness Eve provides.
Is there a way to create a non-collection resource in the domain?