Skip to content

corymsmith/feathers-rest

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

feathers-rest

Build Status

The Feathers REST API provider

About

This provider exposes Feathers services through a RESTful API using Express that can be used with Feathers 1.x and 2.x as well as client support for Fetch, jQuery, Request and Superagent.

Note: For the full API documentation go to feathersjs.com/docs/providers.html.

Quick example

import feathers from 'feathers';
import bodyParser from 'body-parser';
import rest from 'feathers-rest';

const app = feathers()
  .configure(rest())
  .use(bodyParser.json())
  .use(bodyParser.urlencoded({ extended: true }))
  .use(function(req, res, next) {
    req.feathers.data = 'Hello world';
    next();
  });

app.use('/:app/todos', {
  get: function(id, params) {
    console.log(params.data); // -> 'Hello world'
    console.log(params.app); // will be `my` for GET /my/todos/dishes

    return Promise.resolve({
      id,
      params,
      description: `You have to do ${name}!`
    });
  }
});

Client use

import feathers from 'feathers/client';
import rest from 'feathers-rest/client';

import jQuery from 'jquery';
import fetch from 'node-fetch';
import request from 'request';
import superagent from 'superagent';

const app = feathers()
  .configure(rest('http://baseUrl').jquery(jQuery))
  // or
  .configure(rest('http://baseUrl').fetch(fetch))
  // or
  .configure(rest('http://baseUrl').request(request))
  // or
  .configure(rest('http://baseUrl').superagent(superagent))

Changelog

1.0.0

  • Initial release of extracted module from Feathers 1.3

License

Copyright (c) 2015

Licensed under the MIT license.

About

The Feathers REST API provider

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%