denoland / denoland/std

Add Custom 404 Page Support

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

Description

## Feature Description
Currently, the file server responds with a standard "Not Found" status (404) when a requested resource isn't available. To improve the user experience and provide more informative error handling, I propose supporting custom 404 pages.

## Proposed Solution
Add error handling logic to the `createServeDirResponse` function in the server. The new logic should:

1. Check for the existence of a `404.html` file in the root directory when a request for a non-existent resource is made.
2. If present, serve this `404.html` file to the client in place of the standard 404 status.
3. If the `404.html` file doesn't exist, continue returning the standard "Not Found" status.

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.