1.0.11 • Published 6 years ago

@backwood/backwood v1.0.11

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

Backwood Feathers

Backwood Feathers is a Service Provider for AdonisJS for people that enjoy FeathersJS but can't stand its way of file and coding structuring.

Full docs will come soon

Packages

Installation

npm install --save @backwood/backwood

Usage

Okay, start off by creating a new Adonis Project using the CLI:

adonis new blog

now navigate to the server.js file in your root directory and replace .fireHttpServer() with .fire() like so:

server.js

'use strict'

const { Ignitor } = require('@adonisjs/ignitor')

new Ignitor(require('@adonisjs/fold')) .appRoot(__dirname) .fire() // <-- .catch(console.error)

then it's also recommended to remove most of the providers, as Feathers will be handling everything else.

> start/app.js
```js
const providers = [
    '@adonisjs/framework/providers/AppProvider',
    '@backwood/backwood'
]

Backwood Feathers

Create a mandatory file called feathers.js in the start directory.

start/feathers.js

'use strict'

const Feathers = use('Feathers')

Feathers .service('message', 'MessageService')

> app/Services/MessageService
```js
'use strict'

const Service = use('Service')
const Messages = use('Models/Messages')

class MessageService extends Service {

  /**
   * Assign hooks to a service
   *
   * @property hooks
   * @return {Object}
   */
  static get hooks() {
    return {
      before: {
        get: (ctx) => {
          // Define get hook
        }
      }
    }
  }

  get(id, params) {
    return Messages.findById(id)
  }

}

module.exports = MessageService
1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago