You can use List Express API to link the client UI(especially editors like Select or SuggestBox with remote data source) and sever data model.
List Express API helps to perform the next requests:
Method | URL | Description |
---|---|---|
GET | / | Get all records |
GET | /label/:recordId | Get particular record label |
Specify a list model which must implement List Model Interface and can be an instance or a constructor so that the List Express Api will be able to use the provided data model to perform client requests.
Parameters:
Type | Name | Description |
---|---|---|
FormModel | listModel | Required. The instance of a List model |
Or:
Type | Name | Description |
---|---|---|
Function | getModel | Required. Function to be called with Express middleware’s req and res parameters returning a List model instance |
Specify a function to be called when the response is ready.
Parameters:
Type | Name | Description |
---|---|---|
Function | callback | Optional. Function to be called with the result. |
callback
s arguments:
Type | Name | Description |
---|---|---|
Any | err | Error caught from model methods |
Any | data | Result returned by model methods |
Creates an Express router object with middlewares performing requests specified above.
Pass a model instance to Express API:
Or use a constructor for that:
You can also customize your API by adding other methods or define API using other frameworks.
To interact with this API at front-end use List XHR Model.