AngelMunoz / Perla

A cross-platform tool for unbundled front-end development that doesn't depend on Node or requires you to install a complex toolchain
https://perla-docs.web.app/
MIT License
132 stars 11 forks source link

SPA Fallback Middleware #43

Closed AngelMunoz closed 2 years ago

AngelMunoz commented 2 years ago

Is your feature request related to a problem? Please describe. We need to add a SPA fallback middleware for SPA development

Describe the solution you'd like Ideally we need to make sure this is the last middleware in the chain so we don't break existing functionality that requires some routes to fail (like compiling js/ts/tsx on the fly)

Describe alternatives you've considered Nothing so far

Additional context This came up when I was trying to use a client side router with hash disabled

nojaf commented 2 years ago

I've used https://github.com/khellang/Middleware#spafallback- in the past for this scenario. I can try it out when I find time and send a PR if you like.

AngelMunoz commented 2 years ago

If you have a chance and want to take a stab at this you can try to add this middleware somewhere in Server.fs https://github.com/AngelMunoz/Perla/blob/dev/src/Perla.Lib/Server.fs#L480