Tranquil
v0.0.6 Very Beta
Generate powerful RESTful JSON APIs
Installation
npm install tranquil
Usage
Note: This API may change in the future
Create a Tranquil server
var tranquil = ;var server = tranquil;
Note: See all server options below
Add some database validators
server;
Add some RESTful resources
server;server;
Add a special user RESTful resource
server;*Note: UserResources will mixin user specific fields See below for mixinsFinally start the server on port `1337```` javascriptserver.listen(1337);
API
createServer
(options
)
tranquil.Creates a server
instance which can listen on a port.
server
.addResource
(options
)
Adds a RESTful resource to the server instance
options
schema: A Mongoose Schema object.
Note: String validators and property types get replaced with tranquil validators and resources respectively
access: An object which defining the access control list.
databaseMiddleware: Mongoose middleware definitions.
expressMiddleware: Express middleware definitions.
server
.addUserResource
(options
)
...