meteor.gableroux.com

Meteor

Gabriel Le Breton @GabLeRoux SAG-LAC IO
# C'est quoi Meteor?
# C'est pas ça ![](img/meteor-beer-transparent.png)
# Pas ça non plus
# Ça fait quoi? ![](img/xkcd-meteor.png)
# Ça fait pas ça
# Framework javascript pour web apps
# Brièvement * Client + Serveur * Rafraîchissement automatique * Synchronisation de données * Compensation de latence * Système de bundle * ***HOT CODE PUSH*** (oui caps gras italique)

Quoi?

# Passons à l'action

Installation Time!

Demo Time!

Leaderboard Demo

Oh yeah

Regardons un peu le code maintenant :)

leaderboard.js


// Set up a collection to contain player information. On the server,
// it is backed by a MongoDB collection named "players".

Players = new Meteor.Collection("players");


if (Meteor.isClient) {
  Template.leaderboard.players = function () {
    return Players.find({}, {sort: {score: -1, name: 1}});
  };

  Template.leaderboard.selected_name = function () {
    var player = Players.findOne(Session.get("selected_player"));
    return player && player.name;
  };

  Template.player.selected = function () {
    return Session.equals("selected_player", this._id) ? "selected" : '';
  };


 Template.leaderboard.events({
    'click input.inc': function () {
      Players.update(Session.get("selected_player"), {$inc: {score: 5}});
    }
  });

  Template.player.events({
    'click': function () {
      Session.set("selected_player", this._id);
    }
  });
}


// On server startup, create some players if the database is empty.
if (Meteor.isServer) {
  Meteor.startup(function () {
    if (Players.find().count() === 0) {
      var names = ["Ada Lovelace",
                   "Grace Hopper",
                   "Marie Curie",
                   "Carl Friedrich Gauss",
                   "Nikola Tesla",
                   "Claude Shannon"];
      for (var i = 0; i < names.length; i++)
        Players.insert({name: names[i], score: Math.floor(Random.fraction()*10)*5});
    }
  });
}


Hébergement

Plusieurs solutions

  • VPS, amazone, etc.
    • Requiert un accès à NodeJs
  • Serveurs Meteor (Gratuit)
    • meteor deploy nom_de_site.meteor.com
    Heroku
    Heroku

    heroku-buildpack-meteor

    Nouvelle application

    heroku create --stack cedar --buildpack https://github.com/oortcloud/heroku-buildpack-meteorite.git

    Application existante

    heroku config:add BUILDPACK_URL=https://github.com/oortcloud/heroku-buildpack-meteorite.git

    Autres exemples live

    Application réelle

    Lan AEEI-UQAC A13

    Meteorite / Atmoshpere

    Ressources

    Merci!

    Questions?