Newer
Older
FirstProjectMeteor / imports / api / methods / createLink.js
@Motoki Miura Motoki Miura on 29 Jun 2021 317 bytes first
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import Links from '../collections/Links.js';

Meteor.methods({
  'createLink'(title, url) {
    check(url, String);
    check(title, String);

    return Links.insert({
      url,
      title,
      createdAt: new Date(),
    });
  },
});