There are still some rough edges here and there, but it's in a much better shape than what we have today.
595 B
595 B
description
| 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.
import { trailingSlashes } from "fresh";
const app = new App()
.use(trailingSlashes("never"))
.get("/", () => new Response("hello"));
Always append a trailing slash:
import { trailingSlashes } from "fresh";
const app = new App()
.use(trailingSlashes("always"))
.get("/", () => new Response("hello"));