Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

405 all the API endpoints that we will not implement

  • Loading branch information...
commit a2811e1c43250cfdf611f7370dd0a7cc11d11ca8 1 parent 5ed550a
@evdb evdb authored
View
7 fixtures/foobar_instance.js
@@ -18,6 +18,13 @@ exports.people = [
name: "Bill Clinton",
slug: "bill-clinton",
summary: "42nd President of the United States",
+ links: [
+ {
+ "_id": id("4f9ea1326e8770d854c45a26"),
+ url: "http://www.clintonfoundation.org/",
+ comment: "William J. Clinton Foundation",
+ }
+ ],
},
{
"_id": id("4f9ea1316e8770d854c45a1f"),
View
31 lib/apps/api/api_v1.js
@@ -27,7 +27,7 @@ current implementation state:
GET: retrieve one single object (done)
POST: Errors - for us "Treat the addressed member as a collection in its own
- right and create a new entry in it." does not make sense. (todo)
+ right and create a new entry in it." does not make sense. (done)
PUT: partial update of the object, fields not given will be unchanged. This
is so that we don't modify data that we don't know about (ie added by user and
@@ -42,13 +42,13 @@ current implementation state:
POST: append a new entry to the collection (todo)
DELETE, PUT: will not implement - but could be used to delete/replace entire
- embedded collection. Should error 405 (todo)
+ embedded collection. Should error 405 (done)
/api/v1/model/id/sub_collection/id
GET: retrieve document from embedded collection (done)
- POST: errors - see entry for '/api/v1/model/id' (todo)
+ POST: errors - see entry for '/api/v1/model/id' (done)
PUT: partial update of embedded document (todo)
@@ -197,16 +197,27 @@ function create_api_endpoint ( options ) {
api_endpoint.mounted(function (parent_app) {
-
- this.get( '/', read_collection );
- this.get( '/:document_id', read_document );
- this.get( '/:document_id/:sub_name', read_sub_collection );
- this.get( '/:document_id/:sub_name/:sub_id', read_sub_document );
-
- this.post( '/', create );
+ this.get( '/', read_collection );
+ this.post( '/', create );
this.put( '/', method_not_allowed );
this.del( '/', method_not_allowed );
+ this.get( '/:document_id', read_document );
+ this.post( '/:document_id', method_not_allowed );
+ // this.put( '/:document_id', fixme );
+ // this.del( '/:document_id', fixme );
+
+ this.get( '/:document_id/:sub_name', read_sub_collection );
+ // this.post( '/:document_id/:sub_name', fixme );
+ this.put( '/:document_id/:sub_name', method_not_allowed );
+ this.del( '/:document_id/:sub_name', method_not_allowed );
+
+ this.get( '/:document_id/:sub_name/:sub_id', read_sub_document );
+ this.post( '/:document_id/:sub_name/:sub_id', method_not_allowed );
+ // this.put( '/:document_id/:sub_name/:sub_id', fixme );
+ // this.del( '/:document_id/:sub_name/:sub_id', fixme );
+
+
function read_collection (req,res,next) {
var model = req.popit.model(options.schema_name);
View
8 tests/api/writing.js
@@ -229,8 +229,12 @@ module.exports = {
}
var tests = [
- create_error_test( 'put', 'person' ),
- create_error_test( 'del', 'person' ),
+ create_error_test( 'put', 'person' ),
+ create_error_test( 'del', 'person' ),
+ create_error_test( 'post', 'person/4f9ea1316e8770d854c45a1e' ),
+ create_error_test( 'del', 'person/4f9ea1316e8770d854c45a1e/links' ),
+ create_error_test( 'put', 'person/4f9ea1316e8770d854c45a1e/links' ),
+ create_error_test( 'post', 'person/4f9ea1316e8770d854c45a1e/links/4f9ea1326e8770d854c45a26' ),
];
test.expect( tests.length * 3 );
Please sign in to comment.
Something went wrong with that request. Please try again.