rxc-app/tools/createMockDb.js

13 lines
380 B
JavaScript
Raw Normal View History

2020-04-11 20:01:31 +03:00
/* eslint-disable no-console */
const fs = require("fs");
const path = require("path");
const mockData = require("./mockData");
const { courses, authors } = mockData;
const data = JSON.stringify({ courses, authors });
const filepath = path.join(__dirname, "db.json");
fs.writeFile(filepath, data, function (err) {
err ? console.log(err) : console.log("Mock DB created.");
});