Demonstrates how easy it is to decorate a baucis
REST API with custom functionality.
- Exposes a REST API at
/api
and/dev/api
with 3 main endpoints,resources
,users
, andlogs
- The
users
andlogs
endpoints inherit properties and decorators fromresources
- Uses decorators to automatically add the following functionality:
-
reserved
properties - automatically
update
properties -
init
default 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-docs
using 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
mongoose
database undermongodb://localhost/baucis-decorators-example
- Uses
mongoose
as the session store - Allows file uploads
- Enables gzip compression after 256 bytes
git clone git@github.com:loggur/baucis-decorators-example.git
cd baucis-decorators-example
node server/app.js
open localhost:8080/api-docs
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.