apeman-app-rest
apeman app to handle restful endpoint.
Installation
$ npm install apeman-app-rest --save
Usage
- Define an app within Apemanfile.js
- Call the app via apeman app command.
Apemanfile.js
/** This is an example Apemanfile to use apeman-app-rest */ 'use strict' const db = // Apeman db modle instanceconst User = dbmodels moduleexports = $pkg: /* ... */ $apps: // Define your own app. 'my-app-01': // Map url and handlers. '/': User // Options
Then,
$ apeman app my-app-01 -p 3000
'use strict' const apemanrequest = const co = const assert = let request = apemanrequest
Signature
apemanAppRest(models, options) -> function
apeman app to handle restful endpoint.
Args
Name | Type | Default | Description |
---|---|---|---|
models | object | Model objects. | |
options | object | Optional settings. | |
options.pathname | function | '/'+apemanmodel.toType(model) | Spec path name. |
options.knock | Endpoint | boolean | |
options.spec | Endpoint | boolean | |
options.list | Endpoint | boolean | |
options.create | Endpoint | boolean | |
options.bulkUpdate | Endpoint | boolean | |
options.bulkDestroy | Endpoint | boolean | |
options.one | Endpoint | boolean | |
options.update | Endpoint | boolean | |
options.destroy | Endpoint | boolean | |
options.relatedList | Endpoint | boolean | |
options.relatedCreate | Endpoint | boolean | |
options.relatedUpdateBulk | Endpoint | boolean | |
options.relatedDestroyBulk | Endpoint | boolean | |
options.relatedOne | Endpoint | boolean | |
options.relatedUpdate | Endpoint | boolean | |
options.relatedDestroy | Endpoint | boolean | |
options.relationList | Endpoint | boolean | |
options.relationCreate | Endpoint | boolean | |
options.relationUpdate | Endpoint | boolean | |
options.relationDestroy | Endpoint | boolean |
License
This software is released under the MIT License.