1.0.13 • Published 10 years ago

sails-linking-models v1.0.13

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

sails-linking-models

Build Coverage Quality Dependencies

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 = require('sails-linking-models');
   var model = {
      // Your model declaration here
      };
   module.exports = linkingModels.mixin(model);

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.modelLinks(controllerName, reverseRouteService, actions);

Actions will default to the blueprint actions if none is passed in:

   ['findOne', 'update', 'destroy']

Tests

$ npm install
$ npm test
1.0.13

10 years ago

1.0.12

10 years ago

1.0.11

10 years ago

1.0.10

10 years ago

1.0.9

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.0

10 years ago