Replies: 1 comment
-
|
i dont think you can do that with the current nitro version. one way that i handeled that was to get export default defineEventHandler(async (event) => {
// Skip middleware for certain routes
const url = getRequestURL(event)
const skipRoutes = [
'/api/public',
'/api/auth',
// Add other routes that don't need to be run
]
// Check if current route should skip clinic context
const shouldSkip = skipRoutes.some(route => url.pathname.startsWith(route))
if (shouldSkip) {
return
}
// Only run on API routes or specific paths
if (!url.pathname.startsWith('/api/')) {
return
}
try {
// your logic here
}
catch (error: any) {
// Handle errors appropriately
if (error.statusCode) {
throw error
}
throw createError({
statusCode: 500,
statusMessage: 'Failed to load clinic context',
})
}
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In the document, it says:
But I have no idea how to use that. Is there any example? Like a middleware for "/images/:fileId"?
Beta Was this translation helpful? Give feedback.
All reactions