aziosxjs 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +178 -0
- package/package.json +18 -4
package/README.md
CHANGED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# Aziosxjs
|
|
2
|
+
|
|
3
|
+
A lightweight HTTP client for Node.js inspired by Axios.
|
|
4
|
+
|
|
5
|
+
Aziosxjs provides a simple and clean API for making HTTP requests while keeping the internal architecture modular and extensible.
|
|
6
|
+
|
|
7
|
+
This project was built to explore how HTTP client libraries like Axios work internally, including request pipelines, interceptors, and adapter-based networking.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
* Simple and clean API
|
|
14
|
+
* Promise-based HTTP requests
|
|
15
|
+
* Built using low-level Node.js `http` and `https` modules
|
|
16
|
+
* Interceptor system for request/response manipulation
|
|
17
|
+
* TypeScript support
|
|
18
|
+
* Modular architecture for future extensions
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
Install the package using npm:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
npm install aziosxjs
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Quick Example
|
|
33
|
+
|
|
34
|
+
```javascript
|
|
35
|
+
import azios from "aziosxjs";
|
|
36
|
+
|
|
37
|
+
async function getUsers() {
|
|
38
|
+
const response = await azios.get(
|
|
39
|
+
"https://jsonplaceholder.typicode.com/users"
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
console.log(response.data);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
getUsers();
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Basic Usage
|
|
51
|
+
|
|
52
|
+
### GET Request
|
|
53
|
+
|
|
54
|
+
```javascript
|
|
55
|
+
const res = await azios.get("https://api.example.com/users");
|
|
56
|
+
|
|
57
|
+
console.log(res.data);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
### POST Request
|
|
63
|
+
|
|
64
|
+
```javascript
|
|
65
|
+
const res = await azios.post(
|
|
66
|
+
"https://api.example.com/login",
|
|
67
|
+
{
|
|
68
|
+
username: "user",
|
|
69
|
+
password: "password"
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
console.log(res.data);
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Interceptors
|
|
79
|
+
|
|
80
|
+
Interceptors allow you to modify requests or responses globally.
|
|
81
|
+
|
|
82
|
+
### Request Interceptor
|
|
83
|
+
|
|
84
|
+
```javascript
|
|
85
|
+
azios.interceptors.request.use(config => {
|
|
86
|
+
console.log("Request intercepted");
|
|
87
|
+
return config;
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
### Response Interceptor
|
|
94
|
+
|
|
95
|
+
```javascript
|
|
96
|
+
azios.interceptors.response.use(response => {
|
|
97
|
+
console.log("Response intercepted");
|
|
98
|
+
return response;
|
|
99
|
+
});
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Architecture Overview
|
|
105
|
+
|
|
106
|
+
Aziosxjs follows a modular architecture:
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
User Code
|
|
110
|
+
↓
|
|
111
|
+
Azios Instance
|
|
112
|
+
↓
|
|
113
|
+
Request Interceptors
|
|
114
|
+
↓
|
|
115
|
+
dispatchRequest (HTTP engine)
|
|
116
|
+
↓
|
|
117
|
+
Node.js http/https modules
|
|
118
|
+
↓
|
|
119
|
+
Response Interceptors
|
|
120
|
+
↓
|
|
121
|
+
Return Response
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Project Structure
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
src
|
|
130
|
+
├── core
|
|
131
|
+
│ ├── Azios.ts
|
|
132
|
+
│ ├── createInstance.ts
|
|
133
|
+
│ └── dispatchRequest.ts
|
|
134
|
+
│
|
|
135
|
+
├── interceptors
|
|
136
|
+
│ └── InterceptorManager.ts
|
|
137
|
+
│
|
|
138
|
+
├── errors
|
|
139
|
+
│ └── AziosError.ts
|
|
140
|
+
│
|
|
141
|
+
├── types
|
|
142
|
+
│ ├── config.ts
|
|
143
|
+
│ ├── request.ts
|
|
144
|
+
│ └── response.ts
|
|
145
|
+
│
|
|
146
|
+
└── index.ts
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Roadmap
|
|
152
|
+
|
|
153
|
+
Future improvements planned:
|
|
154
|
+
|
|
155
|
+
* Interceptor execution pipeline
|
|
156
|
+
* Automatic JSON parsing
|
|
157
|
+
* Retry strategy
|
|
158
|
+
* Request deduplication
|
|
159
|
+
* Caching layer
|
|
160
|
+
* Plugin system
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Contributing
|
|
165
|
+
|
|
166
|
+
Contributions are welcome. Feel free to open issues or submit pull requests.
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Author
|
|
171
|
+
|
|
172
|
+
Azeem Ali
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## License
|
|
177
|
+
|
|
178
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aziosxjs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Lightweight HTTP client inspired by axios",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -10,7 +10,21 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"dist"
|
|
12
12
|
],
|
|
13
|
-
"keywords": [
|
|
13
|
+
"keywords": [
|
|
14
|
+
"http",
|
|
15
|
+
"client",
|
|
16
|
+
"axios",
|
|
17
|
+
"request",
|
|
18
|
+
"nodejs"
|
|
19
|
+
],
|
|
14
20
|
"author": "Azeem Ali",
|
|
15
|
-
"license": "MIT"
|
|
16
|
-
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/azeemali2001/azios"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/azeemali2001/azios",
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/azeemali2001/azios/issues"
|
|
29
|
+
}
|
|
30
|
+
}
|