Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.
/frameworkPublic archive

feat(nuxt)!: support universal global middleware - #5038

Merged
pi0 merged 10 commits into
mainfrom
feat/universal-global-middleware
Jun 27, 2022
Merged

feat(nuxt)!: support universal global middleware#5038
pi0 merged 10 commits into
mainfrom
feat/universal-global-middleware

Conversation

@danielroe

@danielroedanielroe commented May 18, 2022

Copy link
Copy Markdown
Member

🔗 Linked issue

resolvesnuxt/nuxt#13888, closes#4795

❓ 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

This adds support for global middleware in the universal router - ie. even if the user doesn't have a pages/ directory. Note that only global middleware is supported so middleware must have a .global.ts suffix for it to be applied on route navigation. (This is for consistency.)

👉 Migration

  • If you are using pages:middleware:extend hook, then you can switch to using app:resolve, where you will be able to access app.middleware.

📝 Checklist

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

@danielroedanielroe added enhancement New feature or request 🍰 p2-nice-to-have Priority 2: nothing is broken but it's worth addressing labels May 18, 2022
@danielroe
danielroe requested a review from pi0May 18, 2022 12:24
@danielroedanielroe self-assigned this May 18, 2022
@netlify

netlifyBot commented May 18, 2022

Copy link
Copy Markdown

Deploy Preview for nuxt3-docs ready!

NameLink
🔨 Latest commit48a6b96
🔍 Latest deploy loghttps://app.netlify.com/sites/nuxt3-docs/deploys/62ac4d7f46172c00089fe88d
😎 Deploy Previewhttps://deploy-preview-5038--nuxt3-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@atinux

Copy link
Copy Markdown
Member

Looks good to me ❤️ , would be nice to add a test for.

@danielroedanielroe changed the title feat(nuxt): support universal global middlewarefeat(nuxt)!: support universal global middlewareMay 19, 2022
@pi0

pi0 commented May 20, 2022

Copy link
Copy Markdown
Member

As discussed with @danielroe remaining changes:

  • Use an array format for middleware (supporting nameless middleware and consistency)
  • Add an alternative hook to extend route middleware. (postponed)

@danielroe

Copy link
Copy Markdown
MemberAuthor

@pi0 Let me know when you plan to review this and I will resolve conflicts.

@pi0

pi0 commented Jun 17, 2022

Copy link
Copy Markdown
Member

@danielroe You can rebase. I think we are close to merge :)

pi0
pi0 approved these changes Jun 27, 2022
@pi0
pi0 merged commit 8c2c80e into mainJun 27, 2022
@pi0
pi0 deleted the feat/universal-global-middleware branch June 27, 2022 12:10
@pi0pi0 mentioned this pull request Jul 11, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

3.xenhancementNew feature or request🍰 p2-nice-to-havePriority 2: nothing is broken but it's worth addressing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support global middleware without pages

3 participants

@danielroe@atinux@pi0