Skip to content

ManagementExpressOpenApiServerUrl

type ManagementExpressOpenApiServerUrl = string | ((input) => string | Promise<string>);

Defined in: management-express/src/types.ts:70

OpenAPI servers[0].url value or resolver for the mounted Express adapter.

Use a string when the public URL is stable. Use a function when the URL depends on the current request, for example forwarded headers, tenant routing, or an Express mount path. Empty strings are normalized to /.

The Express mount path, based on req.baseUrl.

createManagementExpressRouter({
	monque,
	openApi: {
		serverUrl: ({ req }) => {
			const host = req.get('x-forwarded-host') ?? req.get('host') ?? 'localhost';
			return `https://${host}${req.baseUrl}`;
		},
	},
});