🔗 Query Fetch
Lightweight and Easy-to-Use Fetch API Extension Library.
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;
},
},
});
Contributing
Information describing how to contribute can be found in the file.
CONTRIBUTING.md