docs: update more pages for Fresh 2 (#3141)
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user