express-zod-api
Advanced tools
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;Changelog
v21.9.0
MethodPath
type in the code generated by Integration
:
Request
type to be used instead;Integration
;Changelog
v21.7.0
EncodedResponse
public interface in the code generated by Integration
:
Response
and EndcodedResponse
is the second hierarchical level.import { EncodedResponse } from "./generated.ts";
type UsageExample = EncodedResponse["get /v1/user/retrieve"][200];