Copyright 2015 Randal L Kamradt Sr.
REST router.
- Source:
(require("meta-data/meta-rest"))(app, model, store)
Add routes to Express for a basic rest web service. The
web service includes:
GET returns the entire data set
GET :id returns a single document
POST {doc} creates a single document
PUT :id {doc} updates a single document
DELETE :id deletes a single document
It creates routes for each model listed in the input file
It also creates a route for getting the meta-data
TODO pass in a store factory to account for each model in models
Parameters:
Name | Type | Description |
---|---|---|
app |
Object | The Express Object |
model |
Object | basic JSON object that describes the models |
store |
Object | A store API |
- Source:
Methods
(inner) createRoutes(app, model, store)
An internal function that creates a route for
a single model
Parameters:
Name | Type | Description |
---|---|---|
app |
Object | The Express Object |
model |
Object | basic JSON object that describes the model |
store |
Object | A store API |
- Source: