0.5.7 • Published 2 months ago
@gwansikk/server-chain v0.5.7
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
2 months ago
0.5.4
2 months ago
0.5.3
2 months ago
0.5.6
2 months ago
0.5.5
2 months ago
0.5.2
2 months ago
0.5.1
3 months ago
0.5.0
3 months ago
0.4.4
3 months ago
0.4.1
3 months ago
0.4.0
3 months ago
0.4.3
3 months ago
0.4.2
3 months ago
0.3.0
3 months ago
0.2.0
4 months ago
0.1.6
4 months ago
0.1.5
4 months ago
0.1.4
4 months ago
0.1.3
4 months ago
0.1.2
4 months ago
0.1.1
4 months ago
0.1.0
4 months ago