ES6 Component that works as an omnirouter middleware to provide jsonapi responses.
;; router = options;router;//inject middlewarerouter;router);
Quality and Compatibility
Every build and release is automatically tested on the following platforms:
If your platform is not listed above, you can test your local environment for compatibility by copying and pasting the following commands into your terminal:
npm install jsonapi-formatter
cd node_modules/jsonapi-formatter
gulp test-local
Installation
Copy and paste the following command into your terminal to install Jsonapi-formatter:
npm install jsonapi-formatter --save
Import / Require
// ES6
import jsonapi-formatter from "jsonapi-formatter";
// ES5
var jsonapi-formatter = require("jsonapi-formatter");
// Require.js
define(["require"] , function (require) {
var jsonapi-formatter = require("jsonapi-formatter");
});
Getting Started
Json Api Formatter formats your response into a format according to the jsonapi format Currently it works as an omnirouter middleware, or manually by calling the methods
- formatResponse(response) Receives a response object that has at least a set function by now.
- format(body) Receives a body object to add the envelop to it.
Using it with omnirouter
Example usage with omnirouter
;; router = options;router;//inject middlewarerouter;router);
How to Contribute
See something that could use improvement? Have a great feature idea? We listen!
You can submit your ideas through our issues system, or make the modifications yourself and submit them to us in the form of a GitHub pull request.
We always aim to be friendly and helpful.
Running Tests
It's easy to run the test suite locally, and highly recommended if you're using Jsonapi-formatter.js on a platform we aren't automatically testing for.
npm test