Not found
Middleware to show a custom page on 404 errors.
Options
- root string
- Default:
"/home/runner/work/mooncircle/mooncircle/_site" - page404 string
- Default:
"/404.html" - directoryIndex boolean
- Default:
false
Description
This middleware shows a not-found page on 404 errors. Optionally, it can create a directoryIndex for folders.
Installation
This middleware must be used with Lume's HTTP Server. To use it in production, you need a host running a Deno server, like Deno Deploy.
Create an entry point file (for example, serve.ts) with the following code:
import Server from "lume/core/server.ts";
import notFound from "lume/middlewares/not_found.ts";
const server = new Server();
server.use(notFound({
page404: "/404.html", // Default value
}));
server.start();
Local development
This middleware is used by default by Lume in --serve mode with the value of the page404 option.