node-siren-builder
A fluent Siren hypermedia representation builder.
const Siren = ; const entity = Siren ; const siren = entity; // siren = {// class: ['home'],// properties: {// version: '2.4.1',// health: 'green'// },// actions: [// {// name: 'find-widget',// method: 'GET',// href: 'https://api.example.org/widgets/search',// title: 'Find Widget',// type: 'application/x-www-form-urlencoded',// fields: [// {// name: 'q',// type: 'text'// }// ]// }// ],// links: [// {// rel: ['self'],// href: 'https://api.example.org/'// }// ]// }
Installation
$ npm install siren-builder
API
Alternatives
If you are not building Siren representations imperatively and are able to specify them in one expression, you may prefer to use node-siren-writer for syntactic brevity.