mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Fix(skel-svelte): adjusted skel startup and added links.js
This commit is contained in:
3
tools/static-assets/skel-svelte/imports/api/links.js
Normal file
3
tools/static-assets/skel-svelte/imports/api/links.js
Normal file
@@ -0,0 +1,3 @@
|
||||
import { Mongo } from 'meteor/mongo';
|
||||
|
||||
export const LinksCollection = new Mongo.Collection('links');
|
||||
@@ -1,5 +1,31 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { LinksCollection } from '/imports/api/links';
|
||||
|
||||
Meteor.startup(() => {
|
||||
// code to run on server at startup
|
||||
async function insertLink({ title, url }) {
|
||||
await LinksCollection.insertAsync({ title, url, createdAt: new Date() });
|
||||
}
|
||||
|
||||
Meteor.startup(async () => {
|
||||
// If the Links collection is empty, add some data.
|
||||
if (LinksCollection.find().count() === 0) {
|
||||
await insertLink({
|
||||
title: 'Do the Tutorial',
|
||||
url: 'https://svelte-tutorial.meteor.com/',
|
||||
});
|
||||
|
||||
await insertLink({
|
||||
title: 'Follow the Guide',
|
||||
url: 'https://guide.meteor.com',
|
||||
});
|
||||
|
||||
await insertLink({
|
||||
title: 'Read the Docs',
|
||||
url: 'https://docs.meteor.com',
|
||||
});
|
||||
|
||||
await insertLink({
|
||||
title: 'Discussions',
|
||||
url: 'https://forums.meteor.com',
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user