Meetup MeteorJS

Lyon

#11

Pré-Meetup

Evolution de Meteor

v1.0

28/10/2014

v1.1

31/03/2015

windows

v1.2

21/09/2015

Galaxy, es6, react, angular

v1.3

28/03/2016

Npm, module es6

v1.4

xx/xx/xxxx

core split to npm, apolloStack

Whats'up

  • Meteor 1.3.3.1
  • Full Npm
  • ApolloStack
  • On the road to Node4 & Mongo3
  • Full split of the core
  • Angular2 & VueJs
  • Galaxy Europe

Collection Helpers

Par @nicooprat

Asteroid

Par @rebolon

Pourquoi ?

  • S'intégrer dans un SI
  • Rester cohérent avec la philosophie Meteor :
    • Pas de REST
    • Publish / Subscribe
    • Accès aux méthodes (~ RPC)
    • Authentification

Asteroid

  • API simple
  • Promise or EventEmitter
  • DDP
  • Login / Signup

Un exemple ?

npm install asteroid asteroid-immutable-collections-mixin immutable

...

import {createClass} from "asteroid";
import immutableCollectionMixin from "asteroid-immutable-collections-mixin";

const Asteroid = createClass([immutableCollectionMixin]);

// Connect to a Meteor backend
const asteroid = new Asteroid({
  endpoint: "ws://localhost:3008/websocket" // use config
});

// Call a method
let params = [1, 2];
asteroid.call('myMethod', params)
  .then((res) => {
    console.info('response ok');
  })
  .catch((err) => {
    console.warn(err);
  });

// login (manage auto-reconnection)
asteroid.loginWithPassword({"email": login, "password": password})
  .then(res => {
    console.info("loginWithPassword", res);
  })
  .catch(error => {
    console.error("loginWithPassword Error", error);
  });

asteroid.on("loggedIn", () => {
  console.info("loggedIn sent from asteroid");
});

asteroid.on("loggedOut", () => {
  console.info("Loggedout sent from asteroid");
});

asteroid.ddp.on("connected", () => {
  console.info('connected to server');
});

// subscribe
let subscription = asteroid.subscribe("your-publication-key");
let myCollection;
subscriptionon('ready', () => {
  myCollection = asteroid.collections.get("your-collection-store");
});

Des questions ?

2 licences JetBrains à gagner

Meetup #11 MeteorJS Lyon

By Retour d'expérience MeteorJS

Meetup #11 MeteorJS Lyon

  • 2,488