0.1.0 • Published 8 years ago

hapi-sequelize-rest v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

hapi-sequelize-rest

RESTful Hapi routes based on sequelize models

Install

$ npm install hapi-sequelize-rest

Usage

Register your sequelize models with hapi-sequelize and then register hapi-sequelize-rest.

For example, in a manifest:

{
    plugin: {
        register: './models',
        options: {
            uri: Config.get('/database/uri')
        }
    }
},
{
    plugin: {
        register: 'hapi-sequelize-rest',
        options: {
            prefix: '/api/v1',
            readOnly: false
        }
    }
}

Options

  • prefix: You can provide a prefix for your api routes. By default api routes will be registered against the root of your site.

  • readOnly: Set this to a truthy value and hapi-sequelize-rest will only register routes for GET-ing resources.

TODO

  1. Provide an option for authentication.
  2. Add some tests.

License

MIT