baucis-decorator-file
Allows properties to be exposed as files.
Install
npm install baucis-decorators baucis-decorator-file --save
Usage
Add the decorator and it will add the functionality to any properties containing a file
field set to some mime-type
. For the following example, you could GET the jsx
as a file via something like /api/components/123.jsx
or /api/components/my-component.123.jsx
.
Example
controllers/Component.js
var baucis = ;var mongoose = ;var Schema = mongooseSchema; var extend = ;var ResourceProps = ;var ResourceController = ; var ComponentProps = ; ComponentPropsjsx = type: String file: 'text/jsx'; var ComponentSchema = ComponentProps;var ComponentModel = mongoose;var ComponentController = baucis; var decorators = ; // decorate controllerdecoratorsadd; /** * Expose controller. */moduleexports = ComponentController;