Skip to content

Commit 1b58fe5

Browse files
committed
docs
1 parent 2e26f37 commit 1b58fe5

File tree

2 files changed

+14
-10
lines changed
  • packages/documentation/src/app/guides/server-templates

2 files changed

+14
-10
lines changed

packages/documentation/src/app/guides/server-templates/typescript-express/page.mdx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,24 +193,26 @@ code generation tooling doesn't support something you need (see also [roadmap](/
193193

194194
Eg: response headers are not yet supported.
195195

196-
To account for these situations, we pass the raw express `req` and `res` objects to your handler implementations,
196+
To account for these situations, we pass the raw express `req`, `res` and `next` objects to your handler implementations,
197197
allowing you full control where its needed.
198198
```typescript
199-
const createTodoList: CreateTodoList = async ({body}, respond, req, res) => {
199+
const createTodoList: CreateTodoList = async ({body}, respond, req, res, next) => {
200200
res.setHeader("x-ratelimit-remaining", "100")
201201
// ...your implementation
202202
return respond.with200().body({ /* ... */ })
203203
}
204204
```
205205

206-
It's also possible to skip response processing if needed by returning `ExpressRuntimeResponse.Skip` from your implementation.
206+
It's also possible to skip response processing if needed by returning `SkipResponse` from your implementation.
207207
This allows you take complete control of the response.
208208
```typescript
209-
const getProfileImage: GetProfileImage = async ({body}, respond, req, res) => {
209+
import {SkipResponse} from '@nahkies/typescript-express-runtime/server'
210+
211+
const getProfileImage: GetProfileImage = async ({body}, respond, req, res, next) => {
210212
res.setHeader("x-ratelimit-remaining", "100")
211213
res.status(200).send(Buffer.from([/*some binary file*/]))
212214

213-
return ExpressRuntimeResponse.Skip
215+
return SkipResponse
214216
}
215217
```
216218

packages/documentation/src/app/guides/server-templates/typescript-koa/page.mdx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,25 +193,27 @@ code generation tooling doesn't support something you need (see also [roadmap](/
193193

194194
Eg: response headers are not yet supported.
195195

196-
To account for these situations, we pass the raw koa `ctx` object to your handler implementations,
196+
To account for these situations, we pass the raw koa `ctx` object and `next` function to your handler implementations,
197197
allowing you full control where its needed.
198198
```typescript
199-
const createTodoList: CreateTodoList = async ({body}, respond, ctx) => {
199+
const createTodoList: CreateTodoList = async ({body}, respond, ctx, next) => {
200200
ctx.set("x-ratelimit-remaining", "100")
201201
// ...your implementation
202202
return respond.with200().body({ /* ... */ })
203203
}
204204
```
205205

206-
It's also possible to skip response processing if needed by returning `KoaRuntimeResponse.Skip` from your implementation.
206+
It's also possible to skip response processing if needed by returning `SkipResponse` from your implementation.
207207
This allows you take complete control of the response.
208208
```typescript
209-
const getProfileImage: GetProfileImage = async ({body}, respond, ctx) => {
209+
import {SkipResponse} from '@nahkies/typescript-koa-runtime/server'
210+
211+
const getProfileImage: GetProfileImage = async ({body}, respond, ctx, next) => {
210212
ctx.set("x-ratelimit-remaining", "100")
211213
ctx.status =200
212214
ctx.body = Buffer.from([/*some binary file*/])
213215

214-
return KoaRuntimeResponse.Skip
216+
return SkipResponse
215217
}
216218
```
217219

0 commit comments

Comments
 (0)