You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

17 lines
470 B

  1. /* eslint-disable no-console */
  2. const fs = require("fs");
  3. const path = require("path");
  4. const mockData = require("./mockData");
  5. const { courses, authors, users /* , Add aditional models here */ } = mockData;
  6. const data = JSON.stringify({
  7. courses,
  8. authors,
  9. users /* , Add additional models here */,
  10. });
  11. const filepath = path.join(__dirname, "db.json");
  12. fs.writeFile(filepath, data, function (err) {
  13. err ? console.log(err) : console.log("Mock DB created.");
  14. });