Copyright 2015 Randal L Kamradt Sr.
Meta App.
(require("index"))(json) → {Object}
Create the API for the meta-app library. Aggregates all of
methods for createing memory/file/mongo stores along with
an object creator and a router to use with Express.js
Todo: create a single createStore that takes a type as a
parameter.
Parameters:
Name | Type | Description |
---|---|---|
json |
Object | basic JSON object that describes the data |
Returns:
The API object
- Type
- Object
Methods
(inner) createFileStore(modelName, fileName) → {Object}
Creates a file store
Parameters:
Name | Type | Description |
---|---|---|
modelName |
string | The model in the models |
fileName |
string | The file to use to store the data in |
Returns:
A store object that is backed by a file
- Type
- Object
(inner) createMemoryStore(modelName) → {Object}
Creates a memory store
Parameters:
Name | Type | Description |
---|---|---|
modelName |
string | The model in the models |
Returns:
A store object that is backed by memory
- Type
- Object
(inner) createMongoStore(modelName, url, collectionName) → {Object}
Create mongo store
Parameters:
Name | Type | Description |
---|---|---|
modelName |
string | The model in the models |
url |
string | The URL to the mongo database |
collectionName |
string | The collection to use |
Returns:
A store object that is backed by a Mongo Database
- Type
- Object
(inner) modelsFactory() → {Object}
A Object manipulation API
Returns:
The API object
- Type
- Object
(inner) useMetaRest(app, store)
An express router that will create a web service
Parameters:
Name | Type | Description |
---|---|---|
app |
Object | The Express object |
store |
Object | One of the stores created by this API |