Skip to content

juliuscarvajal/yus-jsonapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

#yus-jsonapi

A JSON API (jsonapi.org) Implementation that uses Bookshelfjs models.

Installation

npm install git://github.com/juliuscarvajal/yus-jsonapi

Usage

ES6

import {toJSON} from 'yus-jsonapi';
import {toJSONAPI} from 'yus-jsonapi';
import {response} from 'yus-jsonapi';

ES5

var toJSON = require('yus-jsonapi');
var toJSONAPI = require('yus-jsonapi');
var response = require('yus-jsonapi');

Use with other middlewares

app.use(toJSON); // Converts JSONAPI request body to Bookshelfjs model. Generates the req.data (TODO: Convert to Bookshelfjs model)

// Other middlewares

app.use(toJSONAPI) // Converts the Bookshelfjs model (res.data) provided from previous middlewares to a JSONAPI compliant response. Generates res.jsonapi.

app.use(response) // Sends the res.jsonapi object and sets the appropriate status code.
  • Disclaimer: This is currently under heavy developement. Use at your own risk.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published