service-pilot

2.0.1 • Public • Published

Exchange Services

Initialize the exhcange services class with an array of services to be registered

e.g:

const ExchangeServices = require('exchange-service');
const services = ['books', 'emails'];
const exchangeService = new ExchangeServices(services);
 
let options = {};
if (['PUT', 'POST'].includes(req.method.toUpperCase())) {
    options.body = req.body;
    options.json = true;
}
 
servicePilot.requestResource('books', '/', { 'header': 'value' }, Object.assign({
    method: req.method,
}, options))
.then((data) => {
    res.response = data.body;
    res.statusCode = data.statusCode;
    next();
})
.catch((err) => {
    next(err);
});

Readme

Keywords

none

Package Sidebar

Install

npm i service-pilot

Weekly Downloads

2

Version

2.0.1

License

ISC

Last publish

Collaborators

  • laide
  • paulleduc