ikkez/f3-middleware

Run middleware before all routes

Closed this issue · 1 comments

Hi,

I want to prepare the body for all routes before the route controller got instantiated and to do it only once I want to do this with your middleware. Is it possible to execute it for every route?

I tried following code but * is an invalid routing pattern.

\Middleware::instance()->before("*", function (\Base $f3) {
    echo "Middleware test";
    return;
});

I found the errors...

  1. I forgot to run() the middleware
  2. "POST|PUT *" did the trick.