Skip to content

Commit

Permalink
Document error templates (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
terrencewwong authored and leo committed Jul 20, 2018
1 parent a5a3705 commit 7b728ec
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,14 @@ This is disabled by default and can be enabled like this:

After that, if you access your directory `/test` (for example), you will see an image being rendered if the directory contains a single image file.

## Error templates

The handler will automatically determine the right error format if one occurs and then sends it to the client in that format.

Furthermore, this allows you to not just specifiy an error template for `404` errors, but also for all other errors that can occur (e.g. `400` or `500`).

Just add a `<status-code>.html` file to the root directory and you're good.

## Middleware

If you want to replace the methods the package is using for interacting with the file system, you can pass them as the fourth argument to the function call.
Expand Down

0 comments on commit 7b728ec

Please sign in to comment.