JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 13
  • Score
    100M100P100Q53230F
  • License MIT

Blueprints to turn a Sails.js API into a JSON API

Package Exports

  • sails-json-api-blueprints

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sails-json-api-blueprints) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Sails-JSON-API-Blueprints

NPM version   Build Status

Sails hook to automatically turn a Sails.js API into a JSON API compatible interface.

This hook is still in intense development. See the Roadmap section for more information on what is yet to be implemented

While this module will provide your API with a generic implementation of JSON API, it was primarily intented to ease the communication between Sails.js and Ember.js. Ember works by default with JSON API. Here is a demonstration of sails-json-api-blueprints working with an Ember application : https://github.com/dynamiccast/sails-ember-super-rentals-example

Install

Being a sails hook. There is not much thing to do to make your sails app JSON API compatible. all you have to do is install this node module.

npm install --save sails-json-api-blueprints

Please note the following :

  • Being a set of blueprints this only works if sails.config.blueprints.rest is set to true (is it by default)
  • sails.config.blueprints.pluralize will be set to true to match the JSON API specification

Roadmap

  • JSON API implementation
    • GET all resources
    • POST resource
    • DELETE resource
    • PATCH resource
    • Return proper error if any
    • Relationships
    • Compound Document
    • Links
    • Fields
    • Sorting
    • Pagination
    • Filtering
  • Sails integration
    • Allow the use of auto CreatedAt and UpdatedAt (see #3)
    • Pubsub integration
    • Provide a service to serialize as JSON API for custom endpoints
  • Repository
    • Add tests on travis
    • Provide status on the build on Github

Tests

Simply run npm test

Tests expect the database to be empty. Local disk is used in the dummy app and can be deleted with rm tests/dummy/.tmp/localDiskDb.db.

Thanks

This work is greatly inspired from https://github.com/mphasize/sails-generate-ember-blueprints @mphasize did no longer actively maintain this repositiory, so I decided to fork it and to focus on JSON API compatibility.