scottcorgan / pushstate-server

Static file server that works with HTML5 Pushstate.
421 stars 35 forks source link

Add middleware #3

Closed mulderp closed 10 years ago

mulderp commented 10 years ago

To address:

https://github.com/scottcorgan/pushstate-server/issues/2

Feedback welcome!

mulderp commented 10 years ago

PS not exactly sure how to best test this locally - let me know if you'd like a different style.

mulderp commented 10 years ago

ah, lodash is not needed, and I also can squash the commits would look better, or?

scottcorgan commented 10 years ago

Plan on merging tomorrow. Thanks!

mulderp commented 10 years ago

OK, I cleaned this up a bit, but there is still a small problem. If there is a request to e.g. /api/movies without explicit .json, I've the impression that the modrewrite is catching the route. Hmm... still thinking if it makes sense to include the extra middleware before the rewrite but it would give other problems. Any idea if it would be possible to add a parameter in the modrewrite route?

mulderp commented 10 years ago

Hmm.. might it be possible to check if there is a header like content-type: application/json and if so, ignore the modrewrite...

mulderp commented 10 years ago

Hmm.. maybe only activate the rewrite rule for mime type html: http://en.wikipedia.org/wiki/MIME_type#Type_application - not sure...

scottcorgan commented 10 years ago

Appreciate the hard work. I'm trying to keep the use case simple for this module. Please use superstatic if you need more intimate control.

Thanks