@eggjs/router 4.0.2-beta.0 → 4.0.2-beta.10
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 +6 -6
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -137,10 +137,10 @@ router.get(
|
|
|
137
137
|
next();
|
|
138
138
|
});
|
|
139
139
|
},
|
|
140
|
-
ctx => {
|
|
140
|
+
(ctx) => {
|
|
141
141
|
console.log(ctx.user);
|
|
142
142
|
// => { id: 17, name: "Alex" }
|
|
143
|
-
}
|
|
143
|
+
},
|
|
144
144
|
);
|
|
145
145
|
```
|
|
146
146
|
|
|
@@ -299,7 +299,7 @@ app.use(
|
|
|
299
299
|
throw: true,
|
|
300
300
|
notImplemented: () => new Boom.notImplemented(),
|
|
301
301
|
methodNotAllowed: () => new Boom.methodNotAllowed(),
|
|
302
|
-
})
|
|
302
|
+
}),
|
|
303
303
|
);
|
|
304
304
|
```
|
|
305
305
|
|
|
@@ -318,7 +318,7 @@ router.redirect('/login', 'sign-in');
|
|
|
318
318
|
This is equivalent to:
|
|
319
319
|
|
|
320
320
|
```ts
|
|
321
|
-
router.all('/login', ctx => {
|
|
321
|
+
router.all('/login', (ctx) => {
|
|
322
322
|
ctx.redirect('/sign-in');
|
|
323
323
|
ctx.status = 301;
|
|
324
324
|
});
|
|
@@ -407,10 +407,10 @@ router
|
|
|
407
407
|
if (!ctx.user) return (ctx.status = 404);
|
|
408
408
|
return next();
|
|
409
409
|
})
|
|
410
|
-
.get('/users/:user', ctx => {
|
|
410
|
+
.get('/users/:user', (ctx) => {
|
|
411
411
|
ctx.body = ctx.user;
|
|
412
412
|
})
|
|
413
|
-
.get('/users/:user/friends', ctx => {
|
|
413
|
+
.get('/users/:user/friends', (ctx) => {
|
|
414
414
|
return ctx.user.getFriends().then(function (friends) {
|
|
415
415
|
ctx.body = friends;
|
|
416
416
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eggjs/router",
|
|
3
|
-
"version": "4.0.2-beta.
|
|
3
|
+
"version": "4.0.2-beta.10",
|
|
4
4
|
"description": "Router middleware for egg/koa. Provides RESTful resource routing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"koa",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"@types/methods": "^1.1.4",
|
|
50
50
|
"@types/urijs": "^1.19.25",
|
|
51
51
|
"typescript": "^5.9.3",
|
|
52
|
-
"@eggjs/
|
|
53
|
-
"@eggjs/tsconfig": "3.1.2-beta.
|
|
54
|
-
"@eggjs/
|
|
52
|
+
"@eggjs/koa": "3.1.2-beta.10",
|
|
53
|
+
"@eggjs/tsconfig": "3.1.2-beta.10",
|
|
54
|
+
"@eggjs/supertest": "9.0.2-beta.10"
|
|
55
55
|
},
|
|
56
56
|
"engines": {
|
|
57
57
|
"node": ">=22.18.0"
|