Created
June 12, 2016 22:01
Node's require() Function Can Seamlessly Switch Between .json And .json.js Files
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
{ | |
"users": "SELECT * FROM `user` WHERE isActive = 1" | |
} |
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
module.exports = { | |
users: | |
` | |
SELECT | |
* | |
FROM | |
user | |
WHERE | |
isActive = 1 | |
` | |
}; |
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
// Synchronously read in this JSON data file. | |
var migration = require( "./migration.json" ); | |
console.log( "Users Configuration:" ); | |
console.log( migration.users ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment