smart_garden_server/server/main.js
2020-07-05 12:28:57 +02:00

32 lines
737 B
JavaScript

import { Meteor } from 'meteor/meteor';
import { LinksCollection } from '/imports/api/links';
function insertLink({ title, url }) {
LinksCollection.insert({title, url, createdAt: new Date()});
}
Meteor.startup(() => {
// If the Links collection is empty, add some data.
if (LinksCollection.find().count() === 0) {
insertLink({
title: 'Do the Tutorial',
url: 'https://www.meteor.com/tutorials/react/creating-an-app'
});
insertLink({
title: 'Follow the Guide',
url: 'http://guide.meteor.com'
});
insertLink({
title: 'Read the Docs',
url: 'https://docs.meteor.com'
});
insertLink({
title: 'Discussions',
url: 'https://forums.meteor.com'
});
}
});