docs: update canary docs for Fresh 2 (#3108)

There are still some rough edges here and there, but it's in a much
better shape than what we have today.
This commit is contained in:
Marvin Hagemeister
2025-07-18 15:18:38 +02:00
committed by GitHub
parent a66e0df08d
commit a703e79181
29 changed files with 2094 additions and 62 deletions
+25
View File
@@ -0,0 +1,25 @@
---
description: "Ensure URLs always end or never end with trailing slashes"
---
The `trailingSlashes()` middleware can be used to ensure URL pathnames always
end with a slash character or will never end with one. It redirects the user's
request respectively.
```ts
import { trailingSlashes } from "fresh";
const app = new App()
.use(trailingSlashes("never"))
.get("/", () => new Response("hello"));
```
Always append a trailing slash:
```ts
import { trailingSlashes } from "fresh";
const app = new App()
.use(trailingSlashes("always"))
.get("/", () => new Response("hello"));
```