@aofl/server-environment
TypeScript icon, indicating that this package has built-in type declarations

3.14.1 • Public • Published

@aofl/server-environment

Helps determine dev, stage, prod environments based on hostname.

Api Documentation


Examples


Installation

npm i -S @aofl/server-environment

Usage

import {getServerEnvironment, environmentTypeEnumerate} from '@aofl/server-environment';

const env = getServerEnvironment(/localhost/, /^stage\./);
const debugMode = (env === environmentTypeEnumerate.DEV);

Methods

getServerEnvironment

Takes a devRegex and a stageRegex and tests them against hostname. Returns 'production' if the regexes do not capture any results from hostname.

Name Type Description
devRegex RegExp
stageRegex RegEx

Constants

environmentTypeEnumerate

Key Value
DEV development
STAGE stage
PROD production

Package Sidebar

Install

npm i @aofl/server-environment

Weekly Downloads

62

Version

3.14.1

License

MIT

Unpacked Size

13.6 kB

Total Files

9

Last publish

Collaborators

  • alexdinari