Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Meteor intro talk

Udi h Bauman
February 17, 2013

Meteor intro talk

Code not included - will post the GitHub repo later.

Udi h Bauman

February 17, 2013
Tweet

More Decks by Udi h Bauman

Other Decks in Technology

Transcript

  1. Orientation Meteor is a full-stack Web framework, written in JavaScript

    Like Django, it lets you focus on your app, by providing the stuff in the checklist you need in any web app Unlike Django, its checklist is appropriate for 2013
  2. Meteor server & commands • create • add • <run>

    • deploy • reset • remove • mongo • bundle • list Some more:
  3. What's running underneath? Result of ps: • Node.js running Meteor

    • Node.js running our app • MongoDB running our database
  4. Reactive • change source & everything updates • change data

    & everything updates • changes are broadcasted to all clients
  5. Concepts 1. Local synchronized cache 2. As a result: Real-time

    collaboration 3. Reactive 4. MVVM (more about it later)
  6. MVVM Clean & effective separation of concerns: • Model •

    View • View-State • View-Model • Events
  7. View-Model The client model is a View-Model contains a subset

    of the data, according the View-State Updating the View-Model also updates the database
  8. How did this work? By default, meteor uses a package

    called autopublishing, which ensures full data synchronization This meant that any model change in the client is broadcasted to the server & from it to all other clients
  9. Manual publish Meteor.publish("Companies", function() { return companies.find({}, {fields: {name: 1}});

    }); Meteor.publish("Developers", function(company_id) { return companies.find({_id: company_id}); });
  10. Gotta have some server code? // on server: Meteor.methods({ cleanup:

    function() { companies.find({developers: null}).drop(); return "Empty companies removed."; } ); // on client: Meteor.call("cleanup", function(error, result) { alert(result); });
  11. Pluggable apps? $ meteor list You can also turn regular

    npm modules into Meteor smart packages
  12. Change to real-life app • 3 files • 1 JS

    file • autopublishing • no security • meteor hosting • client, server & public folders • extract models & scripts per template • publish & subscribe • allow layer, accounts • bundle & run Node
  13. Short comparison to Django • Server generated templates • SQL

    DB on server • API to expose data • Pluggable apps • Reactive templates • NoSQL DB on both client & server • Synchronized data • Smart packages & manager
  14. Comparison to Node/Express? Meteor uses fibers, to simplify code -

    looks like synchronous code Meteor offers a complete web framework, letting you focus only on your app specifics Meteor uses its own package manager, & not benefiting directly from the npm
  15. So where's the catch? Very young (v0.54) Limited connectivity (API,

    non-browser clients) Performance with heavy DB thru-put Own eco-system (not NPM)
  16. See the examples meteor create --example todos meteor create --example

    leaderboard meteor create --example parties meteor create --example wordplay