mythmon / edwin

A bug management system
Mozilla Public License 2.0
4 stars 0 forks source link

edwin.client should always serve the client as a fallback. #10

Closed mythmon closed 9 years ago

mythmon commented 9 years ago

There are a few general kinds of urls: /api, /static, and "other". API and static views should always run, and in the case of 404s in /api or /static, a normal 404 page should be shown.

On the other hand, any url that doesn't fit those rules should load the React client and let it deal with routing. This way we can make urls like /t/sumo that React can use to show the right content, while still keeping all the client code as one piece (instead of many different apps).

mythmon commented 9 years ago

Right now the client uses urls like /#/t/sumo to work around not having this.

mythmon commented 9 years ago

@willkg Could you take a look at this next time you work on Edwin? I think you stand a better chance of bending the url routing rules to do this (or knowing it isn't a good idea).

willkg commented 9 years ago

I think I understand what you're getting at. Does this look right?:

/api* -> api handling views
/static* -> static handling views
* -> serve client view

If that's correct, then I'm pretty sure this is straight-forward since url patterns are just regexes. The only trick is that we have to make sure the "match everything" url pattern is dead last.

mythmon commented 9 years ago

That looks right. I think that will work, but last time I tried it, the static serving didn't work. I think it was because whitenoise's url handling came after the "serve client view" url. But I didn't spend too much time on it.