express-toolkit 0.8.1 → 0.8.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 +7 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@ Tiny little utilities for reducing expressjs boilerplate code when building simp
|
|
|
19
19
|
- [Default endpoints](#default-endpoints)
|
|
20
20
|
- [Disable endpoints](#disable-endpoints)
|
|
21
21
|
- [Sorting](#sorting)
|
|
22
|
+
- [Pagination](#pagination)
|
|
22
23
|
- [Projection](#projection)
|
|
23
24
|
- [Custom primary key](#custom-primary-key)
|
|
24
25
|
- [Hooks](#hooks)
|
|
@@ -237,6 +238,12 @@ For example, the following request would sort dinosaurs by age, oldest to younge
|
|
|
237
238
|
```http
|
|
238
239
|
GET /dinosaurs?sortby=age&sortorder=DESC
|
|
239
240
|
```
|
|
241
|
+
## Pagination
|
|
242
|
+
GET endpoints support result pagination through `skip` and `limit` parameters:
|
|
243
|
+
- `skip <Number>` tells the endpoint how many results to skip
|
|
244
|
+
- `limit <Number` tells the endpoint how many results to include in the response
|
|
245
|
+
|
|
246
|
+
To implement a pagination scheme, you can leverage these two parameters in the following way: Suppose you want to return `R` results per page and you want to return page number `P`, you just need to set limit to `R` and skip to `(P-1)*R`
|
|
240
247
|
|
|
241
248
|
## Projection
|
|
242
249
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "express-toolkit",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"files": [
|
|
5
5
|
"index.js",
|
|
6
6
|
"src/"
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"test": "nyc --reporter=text ava test/*.spec.js --verbose",
|
|
17
17
|
"test-ci": "npx nyc --reporter=lcov ava test/*.spec.js --verbose",
|
|
18
18
|
"commit": "npx git-cz",
|
|
19
|
+
"documentation": "docsify init ./docs",
|
|
19
20
|
"pre-commit": "npm run lint && npm run test",
|
|
20
21
|
"changelog": "npx easy-changelog --out=./CHANGELOG.md",
|
|
21
22
|
"release": "sh scripts/release.sh"
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
"throwable-http-errors": "^2.1.0"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
|
-
"ava": "^3.
|
|
44
|
+
"ava": "^4.3.1",
|
|
44
45
|
"body-parser": "^1.19.0",
|
|
45
46
|
"eslint": "^7.32.0",
|
|
46
47
|
"eslint-config-standard": "^16.0.3",
|