sails-linking-models
Description
Ability to generate hateoas-compatible links to actions (read/update/delete) on model items.
Install
$ npm install sails-linking-models
Usage
Mixin with your sails model declarations (in /api/models/YOUR_MODEL.js) like so:
var linkingModels = ; var model = // Your model declaration here ; moduleexports = linkingModels;
Inside your model declaration you can generate links by passing in a controller name and the reverseRouteService function, and, optionally, an array of controller actions to link to:
var actions = 'action1' 'action2'; var links = this;
Actions will default to the blueprint actions if none is passed in:
'findOne' 'update' 'destroy'
Tests
$ npm install$ npm test