METEOR BEFORE IMPACT - Entwicklertag · METEOR BEFORE IMPACT Niko Köbler Heiko Spindler @dasniko...

Preview:

Citation preview

METEORBEFOREIMPACT

NikoKöblerHeikoSpindler@dasniko @brainbrix

QualitectsGroup

WHATISMETEOR?

NODE.JSMONGODB

WELL-KNOWN&PRODUCTIVITY-PROVEN

JAVASCRIPTLIBRARIESPACKAGEDINTOONEPOWERFULPLATFORM!

7PRINCIPLES1. DATAONWIRE2. ONELANGUAGE3. DATABASEEVERYWHERE4. LATENCYCOMPENSATION5. FULLSTACKREACTIVITY6. EMBRACETHEECOSYSTEM7. SIMPLICITYEQUALS

PRODUCTIVITY

1.

DATAON

WIRE

2.

ONELANGUAGE

3.

DATABASEEVERYWHERE

4.

LATENCY

COMPENSATION

5.

FULLSTACK

REACTIVITY

6.

EMBRACETHE

ECOSYSTEM

7.

SIMPLICITYEQUALS

PRODUCTIVITY

QUICKSTARTInstallMeteor:

$curlhttps://install.meteor.com|/bin/sh

Createaproject:$meteorcreatemyapp

Runitlocally:$cdmyapp$meteor=>Meteorserverrunningon:http://localhost:3000/

STRUCTURE&

ARCHITECTURE

GENERATEDJS

if(Meteor.isClient){someFunction=function(){//yourcodegoeshere};...}

if(Meteor.isServer){Meteor.startup(function(){//codetorunonserveratstartup});...}

FOLDERSTRUCTURE

/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/...

MONGODB,MINIMONGO

&COLLECTIONS

SYNCHRONIZEDCOLLECTIONS

Messages=newMeteor.Collection("messages");

Messages.find();Messages.findOne();Messages.insert();Messages.update();Messages.remove();

...

PUBLISH/SUBSCRIBE&

METHODCALLS

PUBLISH/SUBSRIBE

//server:publishthemessagescollectionMeteor.publish("messages",function(){returnMessages.find();});

//client:subscribetothepublishedmessagesMeteor.subscribe("messages");

METHODCALLSMeteor.methods({foo:function(arg1,arg2){//..dostuff..if(youwanttothrowanerror)thrownewMeteor.Error(404,"Can'tfindmypants");return"somereturnvalue";},

bar:function(){//..dootherstuff..return"baz";}});

//asynccallMeteor.call('foo',1,2,function(error,result){...});

//synccallvarresult=Meteor.call('foo',1,2);

ACCOUNTS&

SECURITY

ACCOUNTS

$meteoraddaccounts-ui$meteoraddaccounts-*

*=password,facebook,twitter,google,github,...OAuth2

{{>login-buttons}}

ALLOW/DENY

Messages.allow({insert:function(userId,msg){//onlylogged-inuserscaninsertanewmessagethattheyownreturn(userId&&msg.owner==userId);},fetch:['owner']});

Messages.deny({remove:function(userId,msg){//can'tremovelockedmessagesreturnmsg.locked;},fetch:['locked']});

TEMPLATING,LIVEHTML

&HOTCODEREPLACEMENT

SPACEBARSTEMPLATE

<head><title>myapp</title></head>

<body>{{>hello}}</body>

<templatename="hello"><h1>HelloWorld!</h1>{{greeting}}<inputtype="button"value="click"/></template>

LIVEUPDATE

Template.hello.greeting=function(){returnSession.get("welcome_message");};

//somewhereinthecode...Session.set("welcome_message","Welcometomyapp.");

DEPLOYMENT&

PACKAGING

DEPLOYMENT

ONMETEORINFRASTRUCTURE$meteordeploymyapp.meteor.com

$meteordeploywww.myapp.com

ONOWNINFRASTRUCTURE$meteorbundlemyapp.tgz

ECOSYSTEMPACKAGEMANAGEMENT

ATMOSPHERENPM

http://heise.de/-1949891

AMAZON

GOANDBUILDYOUROWN!

www.meteor.com

github.com/dasniko/meteor-reactive-xmplgithub.com/dasniko/meteor-chatgithub.com/brainbrix/PokerQuiz

Recommended