Last active
November 12, 2016 17:54
Script for generating mock data using json-schema-faker and a mock data schema
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
/* This script generates mock data for local development. | |
This way you don't have to point to an actual API, | |
but you can enjoy realistic, but randomized data, | |
and rapid page loads due to local, static data. | |
*/ | |
var jsf = require('json-schema-faker'); | |
var mockDataSchema = require('./mockDataSchema'); | |
var fs = require('fs'); | |
var json = JSON.stringify(jsf(mockDataSchema)); | |
fs.writeFile("./src/api/db.json", json, function (err) { | |
if (err) { | |
return console.log(err); | |
} else { | |
console.log("Mock data generated."); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment