Skip to content

Instantly share code, notes, and snippets.

@krescruz
Created December 20, 2017 18:21
Show Gist options
  • Save krescruz/9dd2efcfedea084f174b732d6337ac7c to your computer and use it in GitHub Desktop.
Save krescruz/9dd2efcfedea084f174b732d6337ac7c to your computer and use it in GitHub Desktop.
Use of conditional variable in development using nodejs
/**
* Example: Base URL to consume REST API only in development
*/
let API_URL = 'https://krescruz.com/api' //URL PRODUCTION
if (!process.env.NODE_ENV || process.env.NODE_ENV === 'development') {
API_URL = 'http://localhost:8000/api' //URL DEVELOPMENT
}
export const API_URL_BASE = API_URL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment