hapi-harvester

0.5.1 • Public • Published

hapi-harvester

a JSONAPI 1.0 plugin for Hapi

Build Status Coverage Status

Overview

Harvester is a Hapi plugin which enables you to define JSONAPI 1.0 resources in an easy, boilerplate-free manner.

// bootstrap a hapi server... and register the plugin
server.register(
    [{
      register: harvester, 
      options: {
        adapter: adapter({
          mongodbUrl: 'mongodb://localhost/test', 
          oplogConnectionString: 'mongodb://localhost/local'})  
      }
    }], () => {
        // define a jsonapi schema 
        var brands = {
            type: 'brands',
            attributes: {
                // use Joi to set validation constraints
                code: Joi.string(),
                description: Joi.string()
            }
        }
        
        const hh = server.plugins['hapi-harvester']
        // register the routes 
        hh.routes.all(brands).forEach((route) => {
            server.route(route)
        })
        server.start()
        
    })

The code for a more complete server can be found in the /example folder.

Features

JSON-API 1.0

Other

  • Extended filter operators : lt, gt, lte, gte
  • Publish change events through SSE

Guides

Quick Start Example Server

Readme

Keywords

Package Sidebar

Install

npm i hapi-harvester

Weekly Downloads

3

Version

0.5.1

License

ISC

Last publish

Collaborators

  • agco
  • kristofsajdak