1.6.0 • Published 5 years ago

sylph-plugin-remote-gateways v1.6.0

Weekly downloads
1
License
Apache-2.0
Repository
-
Last release
5 years ago

Sylph Plugin: Remote Gateways

Remote gateways are a way to interface multiple APIs in a developer-friendly way.

Usage:

1) Create a gateways.json file in the process root directory 2) Add Gateway Endpoint:

{
  "auth": {
    "endpoints": {
      "production": {
        "address": "https://api.example.com",
        "key": "test-key"
      }
    }
  }
}

3) Add gateway middleware to Sylph Project:

const sylph = require('sylph-server');
const { injectGateways } = require('sylph-plugin-remote-gateways');

sylph.expand([
  injectGateways()
]);

4) Access a gateway using req.gateways..post(, {})

module.exports.handler = async (req, res) => {
  const {username, password} = req.body;
  const result = req.gateways['auth'].post('login',{username, password})
  return res.status(200).send(result);
};
1.6.0

5 years ago

1.5.0

5 years ago

1.4.2

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago