-
I'm the author of https://github.com/ad-on-is/adonis-autoswagger, and I'm working on adding v6 support to the plugin. Unfortunatelly, I cannot seem to get the info about the middleware assigned to a route in routes.ts. I've followed the instructions on how to set up an auth middleware with basic auth. So far, the route is protected, so my setup seems fine. router.resource('/test', 'test_controller').use(['index', 'edit'], [middleware.auth()]) console.log(router.toJSON())
// ...
{
"domain": "root",
"pattern": "/test",
"matchers": { },
"meta": { },
"name": "test.index",
"handler": {
"reference": "test_controller.index",
"name": "test_controller.index"
},
"methods": [
"GET",
"HEAD"
],
"middleware": { }
},
{
"domain": "root",
"pattern": "/test/create",
"matchers": { },
"meta": { },
"name": "test.create",
"handler": {
"reference": "test_controller.create",
"name": "test_controller.create"
},
"methods": [
"GET",
"HEAD"
],
"middleware": { }
},
{
"domain": "root",
"pattern": "/test",
"matchers": { },
"meta": { },
"name": "test.store",
"handler": {
"reference": "test_controller.store",
"name": "test_controller.store"
},
"methods": [
"POST"
],
"middleware": { }
},
{
"domain": "root",
"pattern": "/test/:id",
"matchers": { },
"meta": { },
"name": "test.show",
"handler": {
"reference": "test_controller.show",
"name": "test_controller.show"
},
"methods": [
"GET",
"HEAD"
],
"middleware": { }
},
{
"domain": "root",
"pattern": "/test/:id/edit",
"matchers": { },
"meta": { },
"name": "test.edit",
"handler": {
"reference": "test_controller.edit",
"name": "test_controller.edit"
},
"methods": [
"GET",
"HEAD"
],
"middleware": { }
},
{
"domain": "root",
"pattern": "/test/:id",
"matchers": { },
"meta": { },
"name": "test.update",
"handler": {
"reference": "test_controller.update",
"name": "test_controller.update"
},
"methods": [
"PUT",
"PATCH"
],
"middleware": { }
},
{
"domain": "root",
"pattern": "/test/:id",
"matchers": { },
"meta": { },
"name": "test.destroy",
"handler": {
"reference": "test_controller.destroy",
"name": "test_controller.destroy"
},
"methods": [
"DELETE"
],
"middleware": { }
},
// ... Am I missing something? |
Beta Was this translation helpful? Give feedback.
Answered by
ad-on-is
Feb 15, 2024
Replies: 1 comment 5 replies
-
Did you call |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thx for the hint with the list:routes - I got it working!
middleware.all()
that was the key point.