docs: make 2.x the default version (#3369)

This commit is contained in:
Marvin Hagemeister
2025-09-09 14:36:51 +02:00
committed by GitHub
parent 2c315a9972
commit 79d8cfc3ed
109 changed files with 1589 additions and 1502 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 main.ts
import { trailingSlashes } from "fresh";
const app = new App()
.use(trailingSlashes("never"))
.get("/", () => new Response("hello"));
```
Always append a trailing slash:
```ts main.ts
import { trailingSlashes } from "fresh";
const app = new App()
.use(trailingSlashes("always"))
.get("/", () => new Response("hello"));
```