Class: KeystoneRest

KeystoneRest

new KeystoneRest()

Source:

Members

<inner> apiRoot

Root of the API
Source:

Methods

apiDocs() → {String}

Returns the API Docs for the API Created
Source:
Returns:
The Blueprint formatted API
Type
String

createRest(app)

Creates Rest
Parameters:
Name Type Description
app Object Keystone instance
Source:

registerList(list)

Register a Keystone List manually.
Parameters:
Name Type Description
list Object Object of Type Keystone List
Source:

<inner> _addCreate(Model, middleware, selected)

Add post route
Parameters:
Name Type Description
Model Model Mongoose Model
middleware Mixed Express middleware to execute before route handler
selected String String passed to mongoose "select" method
Source:

<inner> _addDelete(model, middleware)

Add delete route
Parameters:
Name Type Description
model Model Mongoose Model
middleware Mixed Express middleware to execute before route handler
Source:

<inner> _addList(model, middleware, selected)

Add get route
Parameters:
Name Type Description
model Model Mongoose Model
middleware Mixed Express middleware to execute before route handler
selected String String passed to mongoose "select" method
Source:

<inner> _addShow(model, middleware, selected)

Add list route
Parameters:
Name Type Description
model Model Mongoose Model
middleware Mixed Express middleware to execute before route handler
selected String String passed to mongoose "select" method
Source:

<inner> _addUpdate(Model, middleware, selected, uneditable)

Add put route
Parameters:
Name Type Description
Model Model Mongoose Model
middleware Mixed Express middleware to execute before route handler
selected String String passed to mongoose "select" method
uneditable Array Array of fields to remove from post
Source:

<inner> _createDocumentation(method, Model)

Creates the documentation for an endpoint
Parameters:
Name Type Description
method String The method to be created
Model Object The Model
Source:

<inner> _flattenRelationships(model)

Convert fields that are relationships to _ids
Parameters:
Name Type Description
model Object instance of mongoose model
Source:

<inner> _getRefName(Model, path)

Get name of reference model
Parameters:
Name Type Description
Model Model Mongoose model
path String Ref path to get name from
Source:

<inner> _getSelected(schema)

Get list of selected fields based on options in schema
Parameters:
Name Type Description
schema Schema Mongoose schema
Source:

<inner> _getSelectedArray(schema)

Get list of selected fields based on options in schema
Parameters:
Name Type Description
schema Schema Mongoose schema
Source:

<inner> _getSelectedFieldsArray(schema)

Get list of selected fields based on options in schema
Parameters:
Name Type Description
schema Schema Mongoose schema
Source:

<inner> _getUneditable(schema)

Get Uneditable
Parameters:
Name Type Description
schema Schema Mongoose schema
Source:

<inner> _registerRestModels(app)

Register the models that has the Rest Option enabled
Parameters:
Name Type Description
app Object Keystone App
Source:

<inner> _send404(res, message)

Send a 404 response
Parameters:
Name Type Description
res Object Express response
message String Message
Source:

<inner> _sendError(err, res)

Send an error response
Parameters:
Name Type Description
err Object Error response object
res Object Express response
Source:

<inner> addRoutes(keystoneList, methods, middleware, relationships)

Add routes
Parameters:
Name Type Description
keystoneList Object Instance of KeystoneList
methods String Methods to expose('list show create update delete')
middleware Object Map containing middleware to execute for each action ({ list: [middleware] })
relationships String Space separated list of relationships to build routes for
Source: