/** * HTTP Route Helper Functions * * This module provides utility functions for creating HTTP route configurations. */ import type { IRouteConfig, IRouteMatch, IRouteAction } from '../../models/route-types.js'; /** * Create an HTTP-only route configuration * @param domains Domain(s) to match * @param target Target host and port * @param options Additional route options * @returns Route configuration object */ export function createHttpRoute( domains: string | string[], target: { host: string | string[]; port: number }, options: Partial = {} ): IRouteConfig { // Create route match const match: IRouteMatch = { ports: options.match?.ports || 80, domains }; // Create route action const action: IRouteAction = { type: 'forward', targets: [target] }; // Create the route config return { match, action, name: options.name || `HTTP Route for ${Array.isArray(domains) ? domains.join(', ') : domains}`, ...options }; }