-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Single page app #19
base: master
Are you sure you want to change the base?
Single page app #19
Conversation
This is useful for single page apps where the routing is handled on the client. I'm using it to serve a webapp using `dodrio`.
I'm happy to accept it. Can you change the option description to bit though: "Single page app mode (404s are redirected to '/')". Instead of "404s redirected to '/'", "404s respond with '/index.html'". That looks to be more accurate. It might be reasonable to just enable this whenever |
Glad you like it! Shall we leave it as a separate option for now, then it can always be rolled into |
Only return the root when the requested file doesn't have an extension. If the file has an extension, it probably is a file that we should 404.
Adding the extension requirement would break urls like ``` /a/path/with/the/last/part/with.a.dot ``` which might come up in user-created URLs.
Is there anything I can do to get this PR pulled in? |
@arranf You can use my fork for now at [dependencies.basic-http-server]
git = "https://github.com/derekdreery/basic-http-server"
branch = "single_page_app" |
Any update on merging this? I'd really prefer to use this over having to depend on web-pack or the like for developing w/ |
I'll try to have a look at getting this ready to merge, but in the mean time you can either use my branch, or there is another static dev server crate that serves the index on failure, |
This PR adds an option to redirect all file misses to the path '/index.html'. This is useful for single-page apps where the routing is done client-side. I'm raising this as a draft PR because it's a new feature out of the blue, and you might not want it. :)