I am trying to explore the opportunity to build a connector for CouchDB for Loopback.io. I know CouchDB has a REST interface but - for some reason - when putting the baseURL of my Couch local server into a Rest connector in Loopback, I get an error back on some headers missing in the request from Couch. Since some useful functions could be added to exploit views and so on, I am exploring the loopback-connector-couchdb creation.
So easy question is: what are the methods that a connector needs to implement to map exactly to the standard API endpoints offered by Loopback.io for a model? Basic example:
POST /models
(with payload body) --> all good on the "create" function of the connectorDELETE /models/{id}
--> I get an error saying that the destroyAll function is NOT implemented (correct) but the destroy function IS implemented instead...- what is the difference between
HEAD /models/{id}
andGET /models/{id}/exists
in terms of the functions called? - I try to verify the existence of the model created (successfully) in CouchDB via ID and use
GET /models/{id}/exists
and instead of having the function "exists" called in the Connector, another function called "Count" is called instead. - It is as if some but not all functions are mapped to the connector (note, I am not using the
DataAccessObject
property of the connector, as that seems to be more for additional methods, so to speak... and one of the methods does work!)
...I am confused!
Thanks for any guidance. I am trying to follow this, but i can't easily map standard API endpoints to the minimum functions of the connector (see point 2 above, for instance) Building a connector - Loopback.io documentation