express-speed 1.0.1 → 1.0.3
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 +36 -38
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
# express-speed
|
|
2
2
|
|
|
3
|
-
`express-speed`
|
|
3
|
+
`express-speed` is a lightweight pager system that makes route creation in Express applications more organized and chainable.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
> 🇹🇷 Türkçe dokümantasyon için [TR.md](./TR.md) dosyasına göz atın.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
7
|
+
## Goals
|
|
8
|
+
|
|
9
|
+
- Simplify route definitions
|
|
10
|
+
- Make pages modular
|
|
11
|
+
- Ease middleware and role-based access control
|
|
12
|
+
- Manage both API and page routes within the same structure
|
|
11
13
|
|
|
12
14
|
---
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
## Installation
|
|
15
17
|
|
|
16
18
|
```bash
|
|
17
19
|
npm install express-speed
|
|
@@ -19,9 +21,9 @@ npm install express-speed
|
|
|
19
21
|
|
|
20
22
|
---
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
## Basic Usage
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
Creating a simple page:
|
|
25
27
|
|
|
26
28
|
```js
|
|
27
29
|
import { pager } from "express-speed";
|
|
@@ -39,9 +41,9 @@ export default page;
|
|
|
39
41
|
|
|
40
42
|
---
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
## Multiple GET Handlers
|
|
43
45
|
|
|
44
|
-
|
|
46
|
+
You can define multiple handlers for the same route.
|
|
45
47
|
|
|
46
48
|
```js
|
|
47
49
|
import { pager } from "express-speed";
|
|
@@ -58,13 +60,13 @@ export default pager
|
|
|
58
60
|
.build();
|
|
59
61
|
```
|
|
60
62
|
|
|
61
|
-
|
|
63
|
+
This pattern works in line with Express middleware logic.
|
|
62
64
|
|
|
63
65
|
---
|
|
64
66
|
|
|
65
|
-
|
|
67
|
+
## Sub Path Routes
|
|
66
68
|
|
|
67
|
-
`get(path, handler)`
|
|
69
|
+
Use `get(path, handler)` to create different endpoints within the same pager.
|
|
68
70
|
|
|
69
71
|
```js
|
|
70
72
|
import { pager } from "express-speed";
|
|
@@ -87,7 +89,7 @@ export default pager
|
|
|
87
89
|
.build();
|
|
88
90
|
```
|
|
89
91
|
|
|
90
|
-
|
|
92
|
+
Generated routes:
|
|
91
93
|
|
|
92
94
|
```
|
|
93
95
|
/blog
|
|
@@ -97,9 +99,9 @@ Oluşan route'lar:
|
|
|
97
99
|
|
|
98
100
|
---
|
|
99
101
|
|
|
100
|
-
|
|
102
|
+
## Middleware Usage
|
|
101
103
|
|
|
102
|
-
|
|
104
|
+
You can add middleware inside a pager.
|
|
103
105
|
|
|
104
106
|
```js
|
|
105
107
|
import { pager } from "express-speed";
|
|
@@ -120,9 +122,9 @@ export default pager
|
|
|
120
122
|
|
|
121
123
|
---
|
|
122
124
|
|
|
123
|
-
|
|
125
|
+
## Role Based Access
|
|
124
126
|
|
|
125
|
-
|
|
127
|
+
Restrict page access using roles.
|
|
126
128
|
|
|
127
129
|
```js
|
|
128
130
|
import { pager } from "express-speed";
|
|
@@ -138,9 +140,9 @@ export default pager
|
|
|
138
140
|
|
|
139
141
|
---
|
|
140
142
|
|
|
141
|
-
|
|
143
|
+
## API Endpoint Example
|
|
142
144
|
|
|
143
|
-
Pager
|
|
145
|
+
Pager can also be used for API endpoints.
|
|
144
146
|
|
|
145
147
|
```js
|
|
146
148
|
import { pager } from "express-speed";
|
|
@@ -158,19 +160,17 @@ export default pager
|
|
|
158
160
|
|
|
159
161
|
---
|
|
160
162
|
|
|
161
|
-
|
|
163
|
+
## GraphQL Integration
|
|
162
164
|
|
|
163
|
-
`express-speed`
|
|
165
|
+
`express-speed` also supports GraphQL endpoints.
|
|
164
166
|
|
|
165
|
-
|
|
167
|
+
The following packages must be installed in your project:
|
|
166
168
|
|
|
167
169
|
```bash
|
|
168
170
|
npm install express-graphql graphql
|
|
169
171
|
```
|
|
170
172
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
## Basic GraphQL Example
|
|
173
|
+
### Basic GraphQL Example
|
|
174
174
|
|
|
175
175
|
```js
|
|
176
176
|
import { pager } from "express-speed";
|
|
@@ -199,11 +199,9 @@ export default pager
|
|
|
199
199
|
.build();
|
|
200
200
|
```
|
|
201
201
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
## GraphQLObjectType Schema Example
|
|
202
|
+
### GraphQLObjectType Schema Example
|
|
205
203
|
|
|
206
|
-
`express-speed`
|
|
204
|
+
`express-speed` also supports the classic GraphQL schema structure.
|
|
207
205
|
|
|
208
206
|
```js
|
|
209
207
|
import { pager } from "express-speed";
|
|
@@ -250,9 +248,9 @@ export default pager
|
|
|
250
248
|
|
|
251
249
|
---
|
|
252
250
|
|
|
253
|
-
|
|
251
|
+
## Router Style Usage
|
|
254
252
|
|
|
255
|
-
Pager
|
|
253
|
+
Pager can be used like a mini router.
|
|
256
254
|
|
|
257
255
|
```js
|
|
258
256
|
import { pager } from "express-speed";
|
|
@@ -273,14 +271,14 @@ export default pager
|
|
|
273
271
|
|
|
274
272
|
---
|
|
275
273
|
|
|
276
|
-
|
|
274
|
+
## Features
|
|
277
275
|
|
|
278
276
|
- Chainable route API
|
|
279
|
-
- Express middleware
|
|
280
|
-
- Role based access
|
|
277
|
+
- Express middleware compatibility
|
|
278
|
+
- Role based access control
|
|
281
279
|
- Multiple route handlers
|
|
282
280
|
- Sub path routing
|
|
283
281
|
- GraphQL integration
|
|
284
|
-
- API
|
|
282
|
+
- API and page route support
|
|
285
283
|
|
|
286
|
-
---
|
|
284
|
+
---
|