express-zod-api
Advanced tools
Changelog
v21.11.1
Changelog
v21.11.0
ctx
is available on instances of BuiltinLogger
:
childLoggerProvider
config option, the ctx
property contains the argument
that was used for creating the child logger using its .child()
method;requestId
property for purposes other than logging;ctx
is an empty object (when the instance is not a child logger).import { BuiltinLogger, createConfig, createMiddleware } from "express-zod-api";
// Declaring the logger type in use
declare module "express-zod-api" {
interface LoggerOverrides extends BuiltinLogger {}
}
// Configuring child logger provider
const config = createConfig({
childLoggerProvider: ({ parent }) =>
parent.child({ requestId: randomUUID() }),
});
// Accessing child logger context
createMiddleware({
handler: async ({ logger }) => {
doSomething(logger.ctx.requestId); // <ā
},
});
Changelog
v21.10.0
Integration
option: serverUrl
, string, optional, the API URL for the generated client:
https://example.com
;new URL()
for constructing the final request URL in the example implementation of the generated client:
serverUrl
both with and without trailing slash;