startup.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // start up function that creates entries in the Websites databases.
  2. Meteor.startup(function () {
  3. // code to run on server at startup
  4. if (!Websites.findOne()) {
  5. console.log("No websites yet. Creating starter data.");
  6. let docs = [
  7. {
  8. title: "Goldsmiths Computing Department",
  9. url: "http://www.gold.ac.uk/computing/",
  10. description: "This is where this course was developed."
  11. },
  12. {
  13. title: "University of London",
  14. url: "http://www.londoninternational.ac.uk/courses/undergraduate/goldsmiths/bsc-creative-computing-bsc-diploma-work-entry-route",
  15. description: "University of London International Programme."
  16. },
  17. {
  18. title: "Coursera",
  19. url: "http://www.coursera.org",
  20. description: "Universal access to the world’s best education."
  21. },
  22. {
  23. title: "Google",
  24. url: "http://www.google.com",
  25. description: "Popular search engine."
  26. }
  27. ];
  28. docs.forEach(function (doc) {
  29. doc.createdOn = new Date();
  30. doc.words = toWords(doc);
  31. Websites.insert(doc);
  32. });
  33. }
  34. });