Reputation: 536
I have a JSON file with about 500 lines on it. I feel like dumping this JSON into the bottom of Node.JS file isn't best practice. What options are available?
Upvotes: 1
Views: 239
Reputation: 5634
You should create a separate file with the JSON contents:
filename.json:
{
.. json content
}
Then in your JS files require it:
var JSON_data = require('./filename.json');
// Access the data using JSON_data.property_name
Upvotes: 4