Skip to content

Commit 420a8cf

Browse files
fry69bartlomiejuclaude
authored
docs: fix misleading main.tsx filenames (#3477)
Closes #3476 --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent be467d3 commit 420a8cf

7 files changed

Lines changed: 15 additions & 11 deletions

File tree

docs/latest/advanced/app-wrapper.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default define.page(({ Component, url }) => {
4747

4848
When building your app with `new App()` instead of file-based routing:
4949

50-
```tsx main.tsx
50+
```tsx
5151
function AppWrapper({ Component }) {
5252
return (
5353
<html lang="en">

docs/latest/advanced/error-handling.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Fresh supports two kind of error pages:
2121
To add an error page use [`app.onError()`](/docs/concepts/app#onerror).
2222

2323
```ts main.ts
24+
import { App } from "fresh";
25+
2426
const app = new App()
2527
.onError("*", (ctx) => {
2628
console.log(`Error: ${ctx.error}`);
@@ -36,7 +38,7 @@ will be invoked.
3638

3739
You can also nest error pages:
3840

39-
```ts main.ts
41+
```ts
4042
const app = new App()
4143
// Top level error page
4244
.onError("*", (ctx) => {
@@ -56,7 +58,7 @@ Not found errors are often treated differently than generic errors. You can both
5658
treat them with the `.onError()` way, but by adding a specific `.notFound()`
5759
handler, Fresh ensures that every 404 error will invoke this callback.
5860

59-
```ts main.ts
61+
```ts
6062
const app = new App()
6163
// Top level error page
6264
.notFound((ctx) => {
@@ -103,7 +105,7 @@ async function authMiddleware(ctx) {
103105
When an `HttpError` is thrown, Fresh catches it and invokes the error handler.
104106
You can check the status code in your error handler:
105107

106-
```ts main.ts
108+
```ts
107109
import { HttpError } from "fresh";
108110

109111
app.onError("*", (ctx) => {

docs/latest/advanced/layouts.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ HTML structure and only the content changes, a layout is a neat way to abstract
1212
this. Layouts only ever render on the server. The passed `Component` value
1313
represents the children of this component.
1414

15-
```tsx main.tsx
15+
```tsx
1616
function PageLayout({ Component }) {
1717
return (
1818
<div>
@@ -42,7 +42,7 @@ You can register multiple layouts for different paths. Layouts are inherited
4242
from parent paths - a layout at `"*"` applies to all routes, and more specific
4343
layouts are added on top:
4444

45-
```ts main.ts
45+
```ts
4646
const app = new App()
4747
.layout("*", MainLayout) // Applied to all routes
4848
.layout("/admin/*", AdminLayout) // Added on top for /admin/* routes
@@ -69,6 +69,6 @@ const app = new App()
6969

7070
Ignore the [app wrapper](/docs/concepts/app) component:
7171

72-
```ts main.ts
72+
```ts
7373
app.layout("/foo/bar", MyComponent, { skipAppWrapper: true });
7474
```

docs/latest/concepts/app.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ mounted alongside other apps. The base path is available in handlers via
4040
All items are applied from top to bottom. This means that when you defined a
4141
middleware _after_ a `.get()` handler, it won't be included.
4242

43-
```ts main.ts
43+
```ts
4444
const app = new App()
4545
.use((ctx) => {
4646
// Will be called for all middlewares

docs/latest/concepts/routing.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Routing defines which middlewares and routes should respond to a particular
77
request.
88

99
```ts main.ts
10+
import { App } from "fresh";
11+
1012
const app = new App()
1113
.get("/", () => new Response("hello")) // Responds to: GET /
1214
.get("/other", () => new Response("other")) // Responds to: GET /other

docs/latest/concepts/static-files.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ once in your build output.
5252
By default, Fresh adds caching headers for the `src` and `srcset` attributes on
5353
`<img>` and `<source>` tags.
5454

55-
```tsx main.tsx
55+
```ts
5656
// Caching headers will be automatically added
5757
app.get("/user", (ctx) => ctx.render(<img src="/user.png" />));
5858
```
5959

6060
You can always opt out of this behaviour per tag, by adding the
6161
`data-fresh-disable-lock` attribute.
6262

63-
```tsx main.tsx
63+
```ts
6464
// Opt-out of automatic caching headers
6565
app.get(
6666
"/user",

docs/latest/introduction/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Fresh is a small, fast and extensible full stack web framework built on Web
99
Standards. It's designed for building high-quality, performant, and personalized
1010
web applications.
1111

12-
```tsx main.tsx
12+
```tsx main.ts
1313
import { App } from "fresh";
1414

1515
const app = new App()

0 commit comments

Comments
 (0)