docs: update more pages for Fresh 2 (#3141)

This commit is contained in:
Marvin Hagemeister
2025-07-25 19:04:08 +02:00
committed by GitHub
parent ff34ec8342
commit b4e4a0c0f0
8 changed files with 130 additions and 8 deletions
+6
View File
@@ -79,6 +79,12 @@ Pass data to the next middlewares with state. Every request has its own state
object.
```ts
interface State {
text?: string;
}
const app = new App<State>();
app.use((ctx) => {
ctx.state.text = "foo";
return ctx.next();
+9
View File
@@ -16,6 +16,15 @@ const app = new App()
.use(staticFiles());
```
The path to the static file directory can be customized on the
[`Builder` class](/docs/canary/concepts/builder) inside your `dev.ts` file.
```ts dev.ts
import { Builder } from "fresh/dev";
const builder = new Builder({ staticDir: "path/to/staticDir" });
```
## Caching headers
By default, Fresh adds caching headers for the `src` and `srcset` attributes on