Constructor
new EntityController()
Defines base controller for all controllers which need to provide HTTP route actions for all requests relative to entities.
- Source:
Extends
Methods
addEntitiesAction(request, response, next)
Adds entities.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
request |
Object | ExpressJS HTTP Request Properties
|
||||||
response |
Object | ExpressJS HTTP Response |
||||||
next |
function | Function to defer execution to the next registered middleware |
- Source:
Example
// Response example
{
"entities": [ ... ],
"total": 42
}
getEntitiesAction(request, response, next)
Gets entities.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object | ExpressJS HTTP Request Properties
|
||||||||||||||||||||||||||||||||||||
response |
Object | ExpressJS HTTP Response |
||||||||||||||||||||||||||||||||||||
next |
function | Function to defer execution to the next registered middleware |
- Source:
Example
// Response example
{
"entities" : [ ... ],
"pagination" : {
"limit": ..., // The limit number of entities by page
"page": ..., // The actual page
"pages": ..., // The total number of pages
"size": ... // The total number of entities
}
getEntityAction(request, response, next)
Gets a specific entity.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object | ExpressJS HTTP Request Properties
|
|||||||||||||||||||||||||||
response |
Object | ExpressJS HTTP Response |
|||||||||||||||||||||||||||
next |
function | Function to defer execution to the next registered middleware |
- Source:
Example
// Response example
{
"entity" : { ... }
}
getProvider() → {EntityProvider}
Gets an instance of the entity provider associated to the controller.
- Source:
Throws:
-
getProvider not implemented for this EntityController
- Type
- Error
Returns:
The entity provider
- Type
- EntityProvider
removeEntitiesAction(request, response, next)
Removes entities.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object | ExpressJS HTTP Request Properties
|
||||||||||||
response |
Object | ExpressJS HTTP Response |
||||||||||||
next |
function | Function to defer execution to the next registered middleware |
- Source:
Example
// Response example
{
"total": 42
}
updateEntityAction(request, response, next)
Updates an entity.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object | ExpressJS HTTP Request Properties
|
|||||||||||||||
response |
Object | ExpressJS HTTP Response |
|||||||||||||||
next |
function | Function to defer execution to the next registered middleware |
- Source:
Example
// Response example
{
"total": 1
}