php-runtime / runtime

A home for runtimes.
MIT License
402 stars 32 forks source link

Cannot register middleware (or configure) server on runtime/react #137

Open ash-m opened 1 year ago

ash-m commented 1 year ago

The runtime/react instantiates an HttpServer for you which is where one would define middleware. Can we abstract this in a decent way? Maybe we can add an optional $middlewares argument to getRunner().

Or something a bit more long-term for people that want to tweak it different ways, perhaps there's a way were we can just extend the ServerFactory to use an HttpServer we configure. Not sure how that would work though. Maybe replace new HttpServer with $this->getHttpServer(), return a new one by default, or whatever the user decided if we've registered that class somehow... perhaps as an option argument to getRunner().