Skip Middleware? #1498
Closed
bruceharrison1984
started this conversation in
General
Replies: 2 comments 1 reply
-
How about this? app.get(
'/static/*',
(c) => {
return c.text('Foo')
},
async (c, next) => {
c.finalized = true
await next()
}
)
// Skipped
app.use('*', async (c, next) => {
await next()
c.header('X-Message', 'Hello')
}) |
Beta Was this translation helpful? Give feedback.
1 reply
-
I figured out the cause of my issue and posted it over on the other repo: sonikjs/sonik#8 |
Beta Was this translation helpful? Give feedback.
0 replies
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
-
I there anyway to say that a particular path (ie
/static/
) shouldn't have middleware run against it? The only working solution I've found is to declare every route except the one that I want to be skipped.In the case of static assets with CF pages, middleware trumps the route and prevents the browser from grabbing the assets directly from CF, causing a 404. I've tried setting routes manually, but it seems like the middleware always runs no matter what I try.
Beta Was this translation helpful? Give feedback.
All reactions