@backwood/rest

1.0.6 • Public • Published

Backwood Feathers REST

Backwood Feathers is a Service Provider for AdonisJS

Full docs will come soon

This is a service provider for providing REST to Feathers

Packages

Installation

npm install --save @backwood/rest

Usage

Add @backwood/rest to the app providers in start/app.js

Backwood REST

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

start/rest.js

'use strict'

const Rest = use('Rest')

exports.globalMiddleware = [
  Rest.express.json(),
  Rest.express.urlencoded({ extended: false })
]

exports.namedMiddleware = {
  auth: (req, res, next) => {
    return !req.user
      ? next(false)
      : next()
  },
  guest: (req, res, next) => {
    return req.user
      ? next(false)
      : next()
  }
}

Rest
  .service('user', 'UserService')
  .group(() => {
    Rest.get('/login', 'LoginController.get')
  }).options({
    middleware: 'guest',
    prefix: 'guest',
    namespace: 'Guest'
  })

Dependencies (4)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @backwood/rest

    Weekly Downloads

    1

    Version

    1.0.6

    License

    MIT

    Unpacked Size

    12 kB

    Total Files

    9

    Last publish

    Collaborators

    • marcus-sa