@@ -95,6 +95,8 @@ async function registerRoutes(app: ApplicationService) {
95
95
. get ( '/articles/:id/:slug?' , [ ( ) => import ( '#controllers/articles_controller' as any ) , 'show' ] )
96
96
. as ( 'articles.show' )
97
97
. domain ( 'blog.adonisjs.com' )
98
+
99
+ router . on ( '/blog' ) . redirect ( '/articles' )
98
100
}
99
101
100
102
test . group ( 'Formatters | List routes | toJSON' , ( ) => {
@@ -207,6 +209,17 @@ test.group('Formatters | List routes | toJSON', () => {
207
209
} ,
208
210
middleware : [ 'auth' , 'acl' , 'signed' , 'throttle' ] ,
209
211
} ,
212
+ {
213
+ handler : {
214
+ args : '/articles' ,
215
+ name : 'redirectsToRoute' ,
216
+ type : 'closure' ,
217
+ } ,
218
+ methods : [ 'GET' ] ,
219
+ middleware : [ ] ,
220
+ name : '' ,
221
+ pattern : '/blog' ,
222
+ } ,
210
223
] ,
211
224
} ,
212
225
{
@@ -353,6 +366,17 @@ test.group('Formatters | List routes | toJSON', () => {
353
366
} ,
354
367
middleware : [ 'auth' , 'acl' , 'signed' , 'throttle' ] ,
355
368
} ,
369
+ {
370
+ handler : {
371
+ args : '/articles' ,
372
+ name : 'redirectsToRoute' ,
373
+ type : 'closure' ,
374
+ } ,
375
+ methods : [ 'GET' , 'HEAD' ] ,
376
+ middleware : [ ] ,
377
+ name : '' ,
378
+ pattern : '/blog' ,
379
+ } ,
356
380
] ,
357
381
} ,
358
382
{
@@ -426,6 +450,7 @@ test.group('Formatters | List routes | toJSON', () => {
426
450
`GET /contact (contact.create) #controllers/contacts_controller.crea… ` ,
427
451
`GET /users ................................... UsersController.handle auth, canViewUsers, closure` ,
428
452
`GET /payments ................ #controllers/payments_controller.index auth, acl, and 2 more` ,
453
+ `GET /blog .............................. redirectsToRoute(/articles) ` ,
429
454
] ,
430
455
} ,
431
456
{
@@ -508,6 +533,10 @@ test.group('Formatters | List routes | toJSON', () => {
508
533
message : `dim(GET)|/payments | cyan(#controllers/payments_controller).cyan(index)|dim(auth, acl, signed, throttle)` ,
509
534
stream : 'stdout' ,
510
535
} ,
536
+ {
537
+ message : `dim(GET)|/blog | cyan(redirectsToRoute)dim((/articles))|dim()` ,
538
+ stream : 'stdout' ,
539
+ } ,
511
540
] )
512
541
} )
513
542
} )
@@ -668,6 +697,17 @@ test.group('Formatters | List routes | filters', () => {
668
697
} ,
669
698
middleware : [ ] ,
670
699
} ,
700
+ {
701
+ handler : {
702
+ args : '/articles' ,
703
+ name : 'redirectsToRoute' ,
704
+ type : 'closure' ,
705
+ } ,
706
+ methods : [ 'GET' ] ,
707
+ middleware : [ ] ,
708
+ name : '' ,
709
+ pattern : '/blog' ,
710
+ } ,
671
711
] ,
672
712
} ,
673
713
{
0 commit comments