create a new document in the Resource's collection.
The document data is read from the request body. A created response is sent with the id of the document if successful.
get a single document in the Resource's collection.
The document's id is sourced from Request#params.id. Additional conditions can be specified via the KEY_GET_PARAMS PRS key.
A successful fetch will respond with [[Ok]] with the document as body otherwise [[NotFound]] is sent.
getModel provides an instance of the Resource's main Model.
remove a single document in the Resource's collection.
The document's id is sourced from Request#params.id.a Additional conditions can be specified via the KEY_REMOVE_PARAMS PRS key.
A successful delete will respond with a [[Ok]] or [[NotFound]] if the document was not found.
search for a document in the Resource's collection.
The query parameters are built using the KEY_SEARCH_PARAMS PRS keys. A successful result with found documents sends a SearchResult, if there are no matches the [[NoContent]] response is sent.
update a single document in the Resource's collection.
The document id is sourced from Request#params.id and the change data from the request body. Additional conditions can be specified via the KEY_UPDATE_PARAMS PRS key.
A successful update will result in an [[Ok]] response whereas a [[NotFound]] is sent if the update was not applied.
Generated using TypeDoc
Resource is the main interface of this module.
It provides a basic JSON based CSUGR interface for a target collection. BaseResource provides a base implementation with hooks for additional processing.
Warning: All data passed to this interface SHOULD BE PROPERLY VALIDATED!! Otherwise users may be able to manipulate queries and have direct access to the database.