From 7b728ec13ebadcad9e89762871f64e6e831bfb49 Mon Sep 17 00:00:00 2001 From: Terrence Wong Date: Fri, 20 Jul 2018 14:12:20 +0200 Subject: [PATCH] Document error templates (#36) --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 9718da8..7532f24 100644 --- a/README.md +++ b/README.md @@ -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 `.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.