denoland / denoland/std

file_server fallback to index.html

Open
#3,420 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3.6k
Forks
681
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**

Using statically-generated single page applications, such as those produced by Vite, return 404 for dynamic deep links, since those paths are not backed by real files.

**Describe the solution you'd like**

An option to fallback to `S{fsRoot}/index.html}` for missing paths.

**Describe alternatives you've considered**

* Use hash routes. Sub-optimal because it impacts user-facing routes
* Use oak. Sub-optimal for Deno Deploy when compared to
```
cd dist/ && deployctl deploy --prod --project=$PROJECT_NAME https://deno.land/std@0.171.0/http/file_server.ts
```
* [This stupid wrapper](https://deno.land/x/spa_server@0.2.0/mod.ts?source) (I just made this)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.