Meteor: how to create a simple demo?

I look at the breakdown of meteors today.

I am interested in this repo:

https://github.com/alethes/meteor-pages

The source code shown looks simple:

this.Pages = new Meteor.Pagination("collection-name"); 

and

 <body> {{> collection-name}} </body> <template name="collection-name"> {{> pages}} {{> pagesNav}} <!--Bottom navigation--> </template> 

I want to break this demography:

https://github.com/meteor/simple-todos

The code I see there is simplified:

 Tasks = new Mongo.Collection("tasks"); if (Meteor.isServer) { // This code only runs on the server Meteor.publish("tasks", function () { return Tasks.find({})})} if (Meteor.isClient) { // This code only runs on the client Meteor.subscribe("tasks"); // ... } 

and

 <body> <ul> {{#each tasks}} {{> task}} {{/each}} </ul> </body> <template name="task"> <li> {{text}} </li> </template> 

Perhaps my brain is a little slow today. It’s not obvious to me how to break the code above.

How to use github.com/alethes/meteor-pages to break the code above into code with simple words?

+5
source share
1 answer

Some time has passed since I used meteorite pages, but you should just replace Tasks = new Mongo.Collection("tasks"); on this.Tasks = new Meteor.Pagination("tasks"); - common code between the client and server.

Mostly meteorite pages simply wrap around the mongo collection and apply search and filter criteria.

If you are familiar with coffeescript, be sure to check their /examples directory in the repo.

In addition, the settings https://github.com/alethes/meteor-pages#settings will help explain some default settings, such as elements on the page, etc.

0
source

Source: https://habr.com/ru/post/1238199/


All Articles