Meteor vor dem Einschlag Ein flexibles JavaScript Framework Heiko - - PowerPoint PPT Presentation

meteor vor dem einschlag
SMART_READER_LITE
LIVE PREVIEW

Meteor vor dem Einschlag Ein flexibles JavaScript Framework Heiko - - PowerPoint PPT Presentation

Meteor vor dem Einschlag Ein flexibles JavaScript Framework Heiko Spindler METEOR BEFORE IMPACT Niko Kbler Heiko Spindler @dasniko @brainbrix WHAT IS METEOR? NODE.JS MONGO DB


slide-1
SLIDE 1

Meteor vor dem Einschlag

Ein flexibles JavaScript Framework

Heiko Spindler

slide-2
SLIDE 2

METEOR BEFORE IMPACT

Niko Köbler Heiko Spindler @dasniko @brainbrix

slide-3
SLIDE 3

WHAT IS METEOR?

slide-4
SLIDE 4

NODE.JS MONGO DB

WELL-KNOWN & PRODUCTIVITY-PROVEN

JAVASCRIPT LIBRARIES PACKAGED INTO ONE POWERFUL PLATFORM!

slide-5
SLIDE 5

7 PRINCIPLES

slide-6
SLIDE 6

1.

DATA

ON

WIRE

slide-7
SLIDE 7

2.

ONE

LANGUAGE

slide-8
SLIDE 8

3.

DATABASE

EVERYWHERE

slide-9
SLIDE 9

4. LATENCY

COMPENSATION

slide-10
SLIDE 10

5. FULL STACK

REACTIVITY

slide-11
SLIDE 11

6. EMBRACE THE

ECOSYSTEM

slide-12
SLIDE 12

7.

SIMPLICITY

EQUALS

PRODUCTIVITY

slide-13
SLIDE 13

QUICKSTART

Install Meteor:

$ curl https://install.meteor.com | /bin/sh

Create a project:

$ meteor create myapp

Run it locally:

$ cd myapp $ meteor => Meteor server running on: http://localhost:3000/

slide-14
SLIDE 14

STRUCTURE & ARCHITECTURE

slide-15
SLIDE 15

GENERATED JS

if (Meteor.isClient) { someFunction = function() { // your code goes here }; ... } if (Meteor.isServer) { Meteor.startup(function() { // code to run on server at startup }); ... }

slide-16
SLIDE 16

FOLDER STRUCTURE

/myapp/... /myapp/lib/... /myapp/somefolder/... /myapp/server/lib/... /myapp/server/someLib.js /myapp/server/main.js /myapp/client/lib/... /myapp/client/someLib.js /myapp/client/main.js /myapp/public/...

slide-17
SLIDE 17

MONGO DB & COLLECTIONS

slide-18
SLIDE 18

SYNCHRONIZED COLLECTIONS

Messages = new Meteor.Collection("messages"); Messages.find(); Messages.findOne(); Messages.insert(); Messages.update(); Messages.remove(); ...

slide-19
SLIDE 19

ALLOW/DENY

Messages.allow({ insert: function (userId, msg) { // only logged-in users can insert a new message that they own return (userId && msg.owner == userId); }, fetch: ['owner'] }); Messages.deny({ remove: function (userId, msg) { //can't remove locked messages return msg.locked; }, fetch: ['locked'] });

slide-20
SLIDE 20

PUBLISH/SUBSCRIBE & METHOD CALLS

slide-21
SLIDE 21

PUBLISH/SUBSRIBE

// server: publish the messages collection Meteor.publish("messages", function () { return Messages.find(); }); // client: subscribe to the published messages Meteor.subscribe("messages");

slide-22
SLIDE 22

METHOD CALLS

Meteor.methods({ foo: function (arg1, arg2) { // .. do stuff .. if (you want to throw an error) throw new Meteor.Error(404, "Can't find my pants"); return "some return value"; }, bar: function () { // .. do other stuff .. return "baz"; } }); // async call Meteor.call('foo', 1, 2, function (error, result) { ... } ); // sync call var result = Meteor.call('foo', 1, 2);

slide-23
SLIDE 23

TEMPLATING, LIVE HTML & HOT CODE REPLACEMENT

slide-24
SLIDE 24

HANDLEBARS TEMPLATE

<head> <title>myapp</title> </head> <body> {{> hello}} </body> <template name="hello"> <h1>Hello World!</h1> {{greeting}} <input type="button" value="click" /> </template>

slide-25
SLIDE 25

LIVE UPDATE

Template.hello.greeting = function() { return Session.get("welcome_message"); }; // somewhere in the code... Session.set("welcome_message", "Welcome to myapp.");

slide-26
SLIDE 26

ACCOUNTS & SECURITY

slide-27
SLIDE 27

ACCOUNTS

$ meteor add accounts-ui $ meteor add accounts-* * = password, facebook, twitter, google, github, ... OAuth2 {{login-buttons}}

slide-28
SLIDE 28

DEPLOYMENT & PACKAGING

slide-29
SLIDE 29

DEPLOYMENT

ON METEOR INFRASTRUCTURE

$ meteor deploy myapp.meteor.com $meteor deploy www.myapp.com

ON OWN INFRASTRUCTURE

$ meteor bundle myapp.tgz

slide-30
SLIDE 30

ECOSYSTEM

slide-31
SLIDE 31

METEORITE & ATMOSPHERE

slide-32
SLIDE 32

GO AND BUILD YOUR OWN!

www.meteor.com github.com/brainbrix/PokerQuiz

slide-33
SLIDE 33

STRUCTURE & ARCHITECTURE MONGO DB & COLLECTIONS PUBLISH/SUBSCRIBE & METHOD CALLS TEMPLATING & LIVE-UPDATE ACCOUNTS & SECURITY DEPLOYMENT & PACKAGING ECOSYSTEM