restify-resourcify

1.3.1 • Public • Published

restify-resourcify

Declarative bindings to restify service endpoint registration.

npm version Dependency Status Build Status

Getting Started

npm install restify-resourcify

Note: You need to have restify installed. Take a look at the peerDependencies in package.json for version compatibility.

Usage

import {Resource, path, GET} from 'restify-resourcify';
 
@path('/users/')
class UserResource extends Resource {
 
  @GET
  async fetchUsers(request) {
    return {
      data: await db.loadUsers
    };
  }
 
  @GET
  @path(':id')
  async fetchUser(request) {
    return {
      data: await db.loadUser({
        id: request.params.id
      })
    };
  }
 
}

Package Sidebar

Install

npm i restify-resourcify

Weekly Downloads

0

Version

1.3.1

License

MIT

Last publish

Collaborators

  • leoselig