0.5.7 • Published 1 year ago

@gwansikk/server-chain v0.5.7

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

npm version npm downloads npm bundle size Codacy Badge

English      한국어

Installation

  • NPM
npm i @gwansikk/server-chain
  • Yarn
yarn add @gwansikk/server-chain

Usage

Instance

const server = ServerChain({
  key: 'INSTANCE',
  baseURL: 'https://jsonplaceholder.typicode.com',
});

server.get({ url: 'posts/1' }).then(data => console.log(data));

Interceptor

const server = ServerChain({
  key: 'INTERCEPTOR',
  baseURL: 'https://jsonplaceholder.typicode.com',
  interceptors: {
    request: request => {
      console.log('** request interceptor **');
      // You need to modify the request and return the modified request.
      // For example, you can add a specific header to the request or modify the URL.
      request.headers = {
        ...request.headers,
        Authorization: 'Bearer YOUR_ACCESS_TOKEN',
      };
      return request;
    },
    response: response => {
      console.log('** response interceptor **');
      // You need to modify the response and return the modified response.
      return response;
    },
    error: response => {
      console.log('** error interceptor **');
      // You need to modify the error response and return the modified response.
      return response;
    },
  },
});

Roadmap

The list below is a roadmap to get to version 1.0.

  • Automatic JSON Conversion
  • Instance Creation
  • Global Settings
  • Request and Response Interceptors
  • Error Status Handling
  • Request Cancellation
  • Progress Bar/Loading Indicator

Contributing

Information describing how to contribute can be found in the file.
CONTRIBUTING.md

0.5.7

1 year ago

0.5.4

1 year ago

0.5.3

1 year ago

0.5.6

1 year ago

0.5.5

1 year ago

0.5.2

1 year ago

0.5.1

1 year ago

0.5.0

1 year ago

0.4.4

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago

0.4.3

1 year ago

0.4.2

1 year ago

0.3.0

1 year ago

0.2.0

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago