Created
October 13, 2014 01:08
-
-
Save justinmc/e143e7ff5027db2eba86 to your computer and use it in GitHub Desktop.
A simple example of how to share code between the front and back ends. This file could be run in either environment and work in both, without code duplication.
This file contains hidden or 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
var config = { | |
version: '3.1.4' | |
}; | |
// Frontend | |
if (window) { | |
window.config = config; | |
// Backend | |
} else if (typeof module !== 'undefined' && module.exports) { | |
module.exports = config; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment