Skip to content

Instantly share code, notes, and snippets.

@spencercarli
Created February 12, 2016 02:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spencercarli/e192695e9204699ee3c6 to your computer and use it in GitHub Desktop.
Save spencercarli/e192695e9204699ee3c6 to your computer and use it in GitHub Desktop.
Easily Connect React Native to a Meteor Server - Add Functionality to the Meteor App - posts.js
Posts = new Mongo.Collection('posts');
Meteor.methods({
'addPost': function() {
Posts.insert({title: 'Post ' + Random.id()});
},
'deletePost': function() {
let post = Posts.findOne();
if (post) {
Posts.remove({_id: post._id});
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment