Skip to content

Commit 22df063

Browse files
authored
docs: hono js docs (#2166)
* docs: hono js docs * fix: remove unused imports from Hono example in web documentation
1 parent 0bb3cd0 commit 22df063

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

docs/web.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -277,27 +277,20 @@ See the [pino-http README](https://npm.im/pino-http) for more info.
277277
npm install pino pino-http hono
278278
```
279279

280-
```ts
281-
import { HttpBindings, serve } from '@hono/node-server';
280+
```js
281+
import { serve } from '@hono/node-server';
282282
import { Hono } from 'hono';
283283
import { requestId } from 'hono/request-id';
284-
import { pino } from 'pino';
285284
import { pinoHttp } from 'pino-http';
286285

287-
declare module 'hono' {
288-
interface ContextVariableMap {
289-
logger: pino.Logger;
290-
}
291-
}
292-
293-
const app = new Hono<{ Bindings: HttpBindings }>();
286+
const app = new Hono();
294287
app.use(requestId());
295288
app.use(async (c, next) => {
296289
// pass hono's request-id to pino-http
297290
c.env.incoming.id = c.var.requestId;
298291

299292
// map express style middleware to hono
300-
await new Promise<void>((resolve) => pinoHttp()(c.env.incoming, c.env.outgoing, () => resolve()));
293+
await new Promise((resolve) => pinoHttp()(c.env.incoming, c.env.outgoing, () => resolve()));
301294

302295
c.set('logger', c.env.incoming.log);
303296

0 commit comments

Comments
 (0)