generateApiSubDomain(
params):string
Defined in: src/dns/generate-api-sub-domain/generate-api-sub-domain.ts:47
Generates an API subdomain based on the stage name and domain name.
This function creates stage-specific API subdomains for different deployment environments. It follows a consistent naming convention where production uses 'api' directly, while other stages include the stage name in the subdomain.
Parameters
params
The parameters object
Returns
string
The generated API subdomain in lowercase format
Example
// Production stage
generateApiSubDomain({ stageName: 'prod', domainName: 'example.com' })
// Returns: 'api.example.com'
// Development stage
generateApiSubDomain({ stageName: 'develop', domainName: 'example.com' })
// Returns: 'api-develop.example.com'
// Custom stage
generateApiSubDomain({ stageName: 'feature-123', domainName: 'example.com' })
// Returns: 'api-feature-123.example.com'
Remarks
- Production stage ('prod') gets the clean 'api.domain.com' format
- Known stages (develop, staging, test) get predictable 'api-
{stage}.domain.com' format - Unknown/custom stages follow the same pattern as known non-production stages
- All output is converted to lowercase for DNS compatibility
Since
1.0.0