vmware-labs / wasm-workers-server

🚀 Develop and run serverless applications on WebAssembly

Home Page:https://workers.wasmlabs.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add "Catch all" workers

Angelmmiguel opened this issue · comments

Is your feature request related to a problem? Please describe.

Sometimes, you need to define workers that will reply to "any other route". These workers provide a response when no other can reply to that route. This is useful for SPAs that are rendered on server side among other use cases.

Describe the solution you'd like

Following the filesystem-based routing, these files are defined as [...ID].ext (See NextJS). They are similar to dynamic parameters, but in this case they include a ... right before the parameter name. The given filename example should capture all these routes:

/a
/test
/a/b
/a/b/c

However, these routes have the lowest possible priority. Any other kind of route (including dynamic params) have a higher priority. When two "catch all" workers can reply to the same request, the one with a higher depth (./sub/[...all].wasm vs ./[...all].wasm) will reply it.

Describe alternatives you've considered

No response

Additional context

No response

@mtt-artis I assigned the task to you for tracking purposes. Thank you for your contribution!

EDIT: Well, I tried but GitHub is not showing your username in the modal yet :/