Created
October 26, 2015 20:49
-
-
Save anomaly44/7e0d3a951cd0b39d1d8b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function formatUrl(path) { | |
const adjustedPath = path[0] !== '/' ? '/' + path : path; | |
if (__SERVER__) { | |
// Prepend host and port of the API server to the path. | |
return 'http://localhost:' + config.apiPort + adjustedPath; | |
} | |
// Prepend `/api` to relative URL, to proxy to API server. | |
return '/api' + adjustedPath; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment