Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs should be in consistent language #2137

Open
jsumners opened this issue Feb 27, 2025 · 0 comments
Open

Docs should be in consistent language #2137

jsumners opened this issue Feb 27, 2025 · 0 comments

Comments

@jsumners
Copy link
Member

PR #2136 added documentation that is not valid JavaScript. All of the rest of our documentation is written in JavaScript. The added code should be refactored to conform to the rest of the documentation.

pino/docs/web.md

Lines 281 to 313 in 562a3f8

import { HttpBindings, serve } from '@hono/node-server';
import { Hono } from 'hono';
import { requestId } from 'hono/request-id';
import { pino } from 'pino';
import { pinoHttp } from 'pino-http';
declare module 'hono' {
interface ContextVariableMap {
logger: pino.Logger;
}
}
const app = new Hono<{ Bindings: HttpBindings }>();
app.use(requestId());
app.use(async (c, next) => {
// pass hono's request-id to pino-http
c.env.incoming.id = c.var.requestId;
// map express style middleware to hono
await new Promise<void>((resolve) => pinoHttp()(c.env.incoming, c.env.outgoing, () => resolve()));
c.set('logger', c.env.incoming.log);
await next();
});
app.get('/', (c) => {
c.var.logger.info('something');
return c.text('Hello Node.js!');
});
serve(app);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant