1.0.1 • Published 10 years ago
baucis-decorators-example v1.0.1
baucis-decorators-example
Demonstrates how easy it is to decorate a baucis REST API with custom functionality.
What this example does
- Exposes a REST API at /apiand/dev/apiwith 3 main endpoints,resources,users, andlogs
- The usersandlogsendpoints inherit properties and decorators fromresources
- Uses decorators to automatically add the following functionality:- reservedproperties
- automatically updateproperties
- initdefault properties using the Express request object
- set properties only once
- adds endpoints for certain properties under development via /dev/api
- authorization(access control) depending on the values of certain properties
- properties for voting
 
- Exposes details of the REST API at /api-docsusing Swagger
- Logs the Express app errors
- Sets a Stripe token depending on the Node process environment
- Redirects to https://www.if in the production environment
- Initializes a mongoosedatabase undermongodb://localhost/baucis-decorators-example
- Uses mongooseas the session store
- Allows file uploads
- Enables gzip compression after 256 bytes
Try it out
git clone git@github.com:loggur/baucis-decorators-example.git
cd baucis-decorators-example
node server/app.js
open localhost:8080/api-docsHow it works
It's probably easiest to just check out the source code in the following order:
And to see how each decorator works, check each repository within this list.
1.0.1
10 years ago