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

@gwansikk/server-chain

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gwansikk/server-chain

The server-chain is a simple and lightweight HTTP Request library.

  • 0.5.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

⛓️ server-chain

A Simple, Lightweight and Easy-to-Use Extension Library for Fetch API.

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

Keywords

FAQs

Package last updated on 12 Mar 2024

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