Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

feathers-forward

Package Overview
Dependencies
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

feathers-forward

A Feathers service addapter for forwarding messages to another feathers application

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

feathers-forward

A Feathers forward service adapter. Supports only rest provider for now.

$ npm install --save feathers-forward

API

configure(options)

Configure Feathers application to forward all unknown services to remote server.

Options:

  • uri (required) - Uri to remote server
  • endpoint - Type of endpoint, for now support feathers (not specified === feathers) and everything else is default behaviour of request parsing
  • reqHeaders - Headers to forward from REST req object (case sensitive)
  • resHeaders - Headers to be added to REST res object from forwarded response (case sensitive)

Example

Here's a example of configuration.

const compress = require('compression');
const helmet = require('helmet');
const cors = require('cors');

const feathers = require('@feathersjs/feathers');
const configuration = require('@feathersjs/configuration');
const express = require('@feathersjs/express');
const forwardMiddleware = require('feathers-forward').middleware;
const forwardConfigure = require('feathers-forward').configure;

const middleware = require('./middleware');
const services = require('./services');

const app = express(feathers());

// Load app configuration
app.configure(configuration());
// Enable security, CORS, compression, favicon and body parsing
app.use(helmet());
app.use(cors());
app.use(compress());
app.use(express.json());
app.use(express.urlencoded({extended: true}));

// Set up Plugins and providers
app.configure(express.rest());

// Configure other middleware (see `middleware/index.js`)
app.configure(middleware);
app.configure(forwardMiddleware); // IMPORTANT
// Set up our services (see `services/index.js`)
app.configure(services);
// Forward everything else
app.configure(forwardConfigure({ // IMPORTANT
  uri: 'https://example.com',
  endpoint: 'feathers',
  reqHeaders: ['authorization'],
  resHeaders: ['custom-header']
}));

// Configure a middleware for 404s and the error handler
app.use(express.notFound());
app.use(express.errorHandler({logger}));

License

MIT

Authors

Keywords

FAQs

Package last updated on 08 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc