Skip to content

Commit a7db57c

Browse files
ci: apply automated fixes
1 parent cb63866 commit a7db57c

File tree

2 files changed

+72
-72
lines changed

2 files changed

+72
-72
lines changed

docs/start/framework/react/server-routes.md

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -394,50 +394,50 @@ export const Route = createFileRoute('/hello')({
394394

395395
You can set the status code of the response by passing it as a property of the second argument to the `Response` constructor
396396

397-
```ts
398-
// routes/hello.ts
399-
import { createFileRoute } from '@tanstack/react-router'
400-
import { json } from '@tanstack/react-start'
401-
402-
export const Route = createFileRoute('/hello')({
403-
server: {
404-
handlers: {
405-
GET: async ({ request, params }) => {
406-
const user = await findUser(params.id)
407-
if (!user) {
408-
return new Response('User not found', {
409-
status: 404,
410-
})
411-
}
412-
return json(user)
413-
},
397+
```ts
398+
// routes/hello.ts
399+
import { createFileRoute } from '@tanstack/react-router'
400+
import { json } from '@tanstack/react-start'
401+
402+
export const Route = createFileRoute('/hello')({
403+
server: {
404+
handlers: {
405+
GET: async ({ request, params }) => {
406+
const user = await findUser(params.id)
407+
if (!user) {
408+
return new Response('User not found', {
409+
status: 404,
410+
})
411+
}
412+
return json(user)
414413
},
415414
},
416-
})
417-
```
415+
},
416+
})
417+
```
418418

419419
In this example, we're returning a `404` status code if the user is not found. You can set any valid HTTP status code using this method.
420420

421421
## Setting headers in the response
422422

423423
Sometimes you may need to set headers in the response. You can do this by passing an object as the second argument to the `Response` constructor.
424424

425-
```ts
426-
// routes/hello.ts
427-
import { createFileRoute } from '@tanstack/react-router'
428-
export const Route = createFileRoute('/hello')({
429-
server: {
430-
handlers: {
431-
GET: async ({ request }) => {
432-
return new Response('Hello, World!', {
433-
headers: {
434-
'Content-Type': 'text/plain',
435-
},
436-
})
437-
},
425+
```ts
426+
// routes/hello.ts
427+
import { createFileRoute } from '@tanstack/react-router'
428+
export const Route = createFileRoute('/hello')({
429+
server: {
430+
handlers: {
431+
GET: async ({ request }) => {
432+
return new Response('Hello, World!', {
433+
headers: {
434+
'Content-Type': 'text/plain',
435+
},
436+
})
438437
},
439438
},
440-
})
441-
// Visit /hello to see the response
442-
// Hello, World!
443-
```
439+
},
440+
})
441+
// Visit /hello to see the response
442+
// Hello, World!
443+
```

docs/start/framework/solid/server-routes.md

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -394,50 +394,50 @@ export const Route = createFileRoute('/hello')({
394394

395395
You can set the status code of the response by passing it as a property of the second argument to the `Response` constructor
396396

397-
```ts
398-
// routes/hello.ts
399-
import { createFileRoute } from '@tanstack/solid-router'
400-
import { json } from '@tanstack/solid-start'
401-
402-
export const Route = createFileRoute('/hello')({
403-
server: {
404-
handlers: {
405-
GET: async ({ request, params }) => {
406-
const user = await findUser(params.id)
407-
if (!user) {
408-
return new Response('User not found', {
409-
status: 404,
410-
})
411-
}
412-
return json(user)
413-
},
397+
```ts
398+
// routes/hello.ts
399+
import { createFileRoute } from '@tanstack/solid-router'
400+
import { json } from '@tanstack/solid-start'
401+
402+
export const Route = createFileRoute('/hello')({
403+
server: {
404+
handlers: {
405+
GET: async ({ request, params }) => {
406+
const user = await findUser(params.id)
407+
if (!user) {
408+
return new Response('User not found', {
409+
status: 404,
410+
})
411+
}
412+
return json(user)
414413
},
415414
},
416-
})
417-
```
415+
},
416+
})
417+
```
418418

419419
In this example, we're returning a `404` status code if the user is not found. You can set any valid HTTP status code using this method.
420420

421421
## Setting headers in the response
422422

423423
Sometimes you may need to set headers in the response. You can do this by passing an object as the second argument to the `Response` constructor.
424424

425-
```ts
426-
// routes/hello.ts
427-
import { createFileRoute } from '@tanstack/solid-router'
428-
export const Route = createFileRoute('/hello')({
429-
server: {
430-
handlers: {
431-
GET: async ({ request }) => {
432-
return new Response('Hello, World!', {
433-
headers: {
434-
'Content-Type': 'text/plain',
435-
},
436-
})
437-
},
425+
```ts
426+
// routes/hello.ts
427+
import { createFileRoute } from '@tanstack/solid-router'
428+
export const Route = createFileRoute('/hello')({
429+
server: {
430+
handlers: {
431+
GET: async ({ request }) => {
432+
return new Response('Hello, World!', {
433+
headers: {
434+
'Content-Type': 'text/plain',
435+
},
436+
})
438437
},
439438
},
440-
})
441-
// Visit /hello to see the response
442-
// Hello, World!
443-
```
439+
},
440+
})
441+
// Visit /hello to see the response
442+
// Hello, World!
443+
```

0 commit comments

Comments
 (0)