Skip to content

feat: add addRouteMiddleware test#827

Merged
danielroe merged 1 commit intonuxt:mainfrom
wattanx:add-add-route-middleware-test
Jun 23, 2023
Merged

feat: add addRouteMiddleware test#827
danielroe merged 1 commit intonuxt:mainfrom
wattanx:add-add-route-middleware-test

Conversation

@wattanx
Copy link
Copy Markdown
Collaborator

@wattanx wattanx commented Jun 23, 2023

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

I would like to add addRouteMiddleware as it was not tested.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@wattanx
Copy link
Copy Markdown
Collaborator Author

wattanx commented Jun 23, 2023

@danielroe
Is the following usage of defineNuxtRouteMiddleware acceptable?
We would like to consider not supporting it because we think it would be difficult to support it in Nuxt Bridge.
(Because it would have to be converted to Nuxt 2 middleware.)

const authMiddleware = defineNuxtRouteMiddleware((to, from) => {
  ...
});

export default defineNuxtPlugin((_nuxt) => {
  addRouteMiddleware('auth', authMiddleware, { global: true })
})

@danielroe
Copy link
Copy Markdown
Member

I would be happy to add a note that this is not supported (if we can't) 👍

@danielroe danielroe changed the title feat: add addRouteMiddleware test feat: add addRouteMiddleware test Jun 23, 2023
@danielroe danielroe merged commit 9b0a98e into nuxt:main Jun 23, 2023
@wattanx
Copy link
Copy Markdown
Collaborator Author

wattanx commented Jun 23, 2023

Thanks!
I added documentation on defineNuxtRouteMiddleware and stated that it is not supported.
nuxt/nuxt#21718

@danielroe danielroe mentioned this pull request Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants