scottcorgan / pushstate-server

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

Call serveStatic before serving index.html #29

Closed geelen closed 8 years ago

geelen commented 8 years ago

This simplifies the implementation, since you no longer need to maintain a list of file type extensions. Now, if a file is found by serveStatic, it'll be served. If not, fall back to index.html (or whatever file you set).

The advantage here is that if you do have static html files in the directory, they'll be served straight up. Which is super handy if you're mixing-and-matching pushstate and static pages, or if you're doing some React prerendering.

I think this is a more expected behaviour, and should make things easier to maintain in the long run (since you don't have to keep adding file extensions to the connect-modrewrite list)

scottcorgan commented 8 years ago

That's a great package and a change I want to see made. This package started as just an experiment to get something working years ago and I guess people started using it.

With that said, I'd love to make this change with tests (which are there are none of at the moment). Any way I could get you to add some tests for this kind of change?

Thanks!

scottcorgan commented 8 years ago

@geelen I've added the initial tests in master. They're not all there, but there's enough I think to prove that this PR passes. Go ahead and rebase and let me know.

geelen commented 8 years ago

@scottcorgan done.

scottcorgan commented 8 years ago

Published as 2.0.0, among other upgrades. Thanks again!