How do you guys implement like/unlike into your apps

Hello there. I need some resources that I can use to implement like/unlike functionality into my apps. I’m looking for the best packages that serve this purpose. Also it work be great to get links to simple projects that use these functionality. Thanks.

Socialize

@copleykj I’ve seen this one, but I dont know how to implement it. Also, there seems to be no demo folder around. Do u have a demo?

Just the liking capability specifically?

yes please @copleykj

Ok so first the likeable package needs a child of BaseModel from socialize:base-model to add it’s functionality to. As an example we can use a book for our model.

//I'll assume you know how to import what you need here :-)

//Let's create our model
let Book = BaseModel.extendAndSetupCollection("books");

//add a schema for security's sake
Book.appendSchema({
  title:{
      type:String
  }
}); 

//this adds our liking functionality
LikeableModel.makeLikeable(Book, "book");

From there create some books that users can like

new Book({
  title:'Moby Dick'
}).save();

new Book({
  title: 'JavaScript: The good parts'
}).save();

Now that you’ve got some books, users can like them.

let book = Meteor.books.findOne();

book.like();

As a note this API will be changing in the near future when an update to the Socialize package set is released.

1 Like