0.2.0 • Published 6 years ago

jsonapi-handler-rest v0.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

jsonapi-handler-rest

jsonapi-handler-rest is a rest api handler for jsonapi-server.

This project follows to the specification laid out in the jsonapi-server handler documentation.

Usage

var RestHandler = require("jsonapi-handler-rest")

jsonApi.define({
  resource: 'users',
  handlers: new RestHandler({
    url: 'http://jsonplaceholder.typicode.com/users',
  }),
  attributes: {
    name: Joi.string(),
    username: Joi.string(),
    email: Joi.string(),
    address: Joi.object().keys({
      street: Joi.string(),
      suite: Joi.string(),
      zipcode: Joi.string(),
      city: Joi.string(),
      geo: Joi.object().keys({
        lat: Joi.string(),
        lng: Joi.string()
      })
    }),
    phone: Joi.string(),
    website: Joi.string(),
    company: Joi.object().keys({
      name: Joi.string(),
      catchPhrase: Joi.string(),
      bs: Joi.string()
    })
  }
})

Features

  • Search, Find

TODO

  • Tests, coverage
  • Create, Delete, Update
  • Filtering, pagination and sorting