File tree Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -277,27 +277,20 @@ See the [pino-http README](https://npm.im/pino-http) for more info.
277
277
npm install pino pino-http hono
278
278
```
279
279
280
- ``` ts
281
- import { HttpBindings , serve } from ' @hono/node-server' ;
280
+ ``` js
281
+ import { serve } from ' @hono/node-server' ;
282
282
import { Hono } from ' hono' ;
283
283
import { requestId } from ' hono/request-id' ;
284
- import { pino } from ' pino' ;
285
284
import { pinoHttp } from ' pino-http' ;
286
285
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 ();
294
287
app .use (requestId ());
295
288
app .use (async (c , next ) => {
296
289
// pass hono's request-id to pino-http
297
290
c .env .incoming .id = c .var .requestId ;
298
291
299
292
// 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 ()));
301
294
302
295
c .set (' logger' , c .env .incoming .log );
303
296
You can’t perform that action at this time.
0 commit comments