_middleware.ts files will not run the handler sometimes (I tried all handler signatures). It is pretty inconsistent, sometimes it runs (e.g. for /route/one, and then for /route/two it won't run. I might be doing something wrong (don't think so this time, I have the WIP docs revamped for Fresh 2.0 open), but I can confirm that at a minimum, the behavior is different than that of _middleware.ts files in fresh 1.x (not sure if intended or not). Funny enough, not doing file-based routing and using app.use((ctx) => {...}) directly instead, in e.g. main.ts with the same handler as in the _middleware.ts file, works normally as it should.
From
this thread
:_middleware.ts
files will not run the handler sometimes (I tried all handler signatures). It is pretty inconsistent, sometimes it runs (e.g. for/route/one
, and then for/route/two
it won't run. I might be doing something wrong (don't think so this time, I have the WIP docs revamped for Fresh 2.0 open), but I can confirm that at a minimum, the behavior is different than that of_middleware.ts
files in fresh 1.x (not sure if intended or not). Funny enough, not doing file-based routing and usingapp.use((ctx) => {...})
directly instead, in e.g.main.ts
with the same handler as in the_middleware.ts
file, works normally as it should.