Skip to content

Instantly share code, notes, and snippets.

@bennadel
Created June 12, 2016 22:01
Node's require() Function Can Seamlessly Switch Between .json And .json.js Files
{
"users": "SELECT * FROM `user` WHERE isActive = 1"
}
module.exports = {
users:
`
SELECT
*
FROM
user
WHERE
isActive = 1
`
};
// 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