Constructor
new REST_ADAPTER(protocol_adapter)
Constructor for REST_Adapter
Parameters:
| Name |
Type |
Description |
protocol_adapter |
Object
|
A protocol adapters that exposes database adapters, response adapters, and an express server |
- Source:
Methods
implement(options) → {Object}
Convenience method for generting controller functions and routes for a given model. See _IMPLEMENT for more details
Parameters:
| Name |
Type |
Description |
options |
Object
|
Configurable options for implementing controller functions and routes for a model
Properties
| Name |
Type |
Description |
model_name |
string
|
The name of the model that the controller functions are being generated for |
router |
Object
|
An express router that routes should be mounted on |
|
- Source:
Returns:
Returns an object that has an express router and controller functions
-
Type
-
Object
routing(options) → {Object}
Appends RESTful routes to an express router
Parameters:
| Name |
Type |
Description |
options |
Object
|
Configurable options for routing
Properties
| Name |
Type |
Description |
router |
Object
|
An express router. If this value is not defined a new express router will be created |
middleware |
Object
|
Middleware functions that are used in generating routes |
override |
Object
|
Full route overrides
Properties
| Name |
Type |
Description |
create_index |
Array.<function()>
|
An array of middleware to use in place of normal GET /model/new route |
update_index |
Array.<function()>
|
An array of middleware to use in place of normal GET /model/edit route |
get_index |
Array.<function()>
|
An array of middleware to use in place of normal GET /model route |
create_item |
Array.<function()>
|
An array of middleware to use in place of normal POST /model route |
get_item |
Array.<function()>
|
An array of middleware to use in place of normal GET /model/:id |
update_item |
Array.<function()>
|
An array of middleware to use in place of PUT /model/:id |
delete_item |
Array.<function()>
|
An array of middleware to use in place of DELETE /model/:id |
|
model_name |
string
|
The name of the model the routes are being created for |
viewmodel |
Object
|
Inflected model name values |
|
- Source:
Returns:
Returns an express router that has RESTful routes registered to it
-
Type
-
Object