Skip to content

@longmo-utils/node / getEnv

Function: getEnv()

ts
function getEnv(key, defaultValue?): string;

获取环境变量

Parameters

ParameterTypeDescription
keystring环境变量键
defaultValue?string默认值

Returns

string

环境变量值

Example

ts
const value = getEnv('API_URL', 'http://localhost:3000')

Released under the MIT License.