2.0.0 • Published 7 years ago

jsonapi-linker v2.0.0

Weekly downloads
23
License
MIT
Repository
github
Last release
7 years ago

JSON API Linker

Build Status Coverage Status

This module allows link manipulation within JSON API documents. It expects to work with valid JSON API objects, so review the spec before using this module.

Usage

var linker = require('jsonapi-linker');

var doc = linker.rewriteLinks('http://public-url.example.com', {
  links: {
    self: 'http://origin-url.example.com/things/1'
  },
  // ...
});
/**
{
  links: {
    self: 'http://public-url.example.com/things/1'
  },
  // ...
}
*/

You may also designate a prefix to remove from the original string, e.g.:

var doc = linker.rewriteLinks('http://public-url.example.com', '/api/v1', {
  links: {
    self: 'http://origin-url.example.com/api/v1/things/1'
  },
  // ...
});
/**
{
  links: {
    self: 'http://public-url.example.com/things/1'
  },
  // ...
}
*/
2.0.0

7 years ago

1.1.4

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.0

9 years ago