⛓️ server-chain
A Simple, Lightweight and Easy-to-Use Extension Library for Fetch API.
English
•
한국어
Installation
npm i @gwansikk/server-chain
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 **');
request.headers = {
...request.headers,
Authorization: 'Bearer YOUR_ACCESS_TOKEN',
};
return request;
},
response: response => {
console.log('** response interceptor **');
return response;
},
error: response => {
console.log('** error interceptor **');
return response;
},
},
});
Roadmap
The list below is a roadmap to get to version 1.0.
Contributing
Information describing how to contribute can be found in the file.
CONTRIBUTING.md