@mcf/request
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

@mcf/request

Exposes a context-aware request using Opentracing headers based on node-fetch.

Scope

  • [x] create a zipkin-instrumented request object

Installation

npm i @mcf/request;
# OR
yarn add @mcf/request;

Usage

In a base request module:

const {createRequest} = require('@mcf/request');
// OR
import {createRequest} from '@mcf/request';
import {tracer} from '../path/to/tracer/component';

export default createRequest({tracer});

In code:

const request = require('../path/to/request/component');

request('http://otherservice:12345', {
  remoteServiceName: 'shopping-cart', // eg only
  ...otherOptions,
})

The other options in :...otherOptions follows the same option schema as node-fetch. View it here.

License

This package is licensed under the MIT license.

Change Log

0.0.1

  • Initial release

Cheers

Readme

Keywords

none

Package Sidebar

Install

npm i @mcf/request

Weekly Downloads

1

Version

1.0.9

License

ISC

Unpacked Size

4.03 kB

Total Files

6

Last publish

Collaborators

  • at_govtech
  • boonsiangteh
  • vicheng.gt
  • npm-govtechsg-mcf-sh