52
Only JavaScript, only Meteor.js Tomáš Hromník (@elfoslav) www.hromnik.com

Only JavaScript, only Meteor.js

Embed Size (px)

Citation preview

Page 1: Only JavaScript, only Meteor.js

Only JavaScript, only Meteor.js

Tomáš Hromník (@elfoslav) www.hromnik.com

Page 2: Only JavaScript, only Meteor.js

Development in PHP

- Context switching- Server language vs. JavaScript

Page 3: Only JavaScript, only Meteor.js

Development in PHP

- Context switching- Server language vs. JavaScript

- Different function names in PHP and JavaScript

Page 4: Only JavaScript, only Meteor.js

Development in PHP

WRONG!!!

Page 5: Only JavaScript, only Meteor.js

Node.js

- JavaScript on the server

Page 6: Only JavaScript, only Meteor.js

Node.js

- JavaScript on the server- Isomorphic applications

Page 7: Only JavaScript, only Meteor.js

Node.js

- JavaScript on the server- Isomorphic applications- JavaScript everywhere

Page 8: Only JavaScript, only Meteor.js

Node.js frameworks

- Sails.js, Geddy.js, Tower.js, Total.js,...

Page 9: Only JavaScript, only Meteor.js

Node.js frameworks

- Sails.js, Geddy.js, Tower.js, Total.js,...- not much killer features

Page 10: Only JavaScript, only Meteor.js

Node.js frameworks

- Sails.js, Geddy.js, Tower.js, Total.js,...- not much killer features- very small community

Page 11: Only JavaScript, only Meteor.js

Node.js frameworks

- Sails.js, Geddy.js, Tower.js, Total.js,...- not much killer features- very small community- lack of learning resources

Page 12: Only JavaScript, only Meteor.js

Node.js frameworks

- Express.js- very lightweight

Page 13: Only JavaScript, only Meteor.js

Node.js frameworks

- Express.js- very lightweight- programmer has to do a lot of work himself

Page 14: Only JavaScript, only Meteor.js

Node.js frameworks

- Meteor.js- a lot of killer features

Page 15: Only JavaScript, only Meteor.js

Node.js frameworks

- Meteor.js- a lot of killer features- easy to learn

Page 16: Only JavaScript, only Meteor.js

Node.js frameworks

- Meteor.js- a lot of killer features- easy to learn- good documentation

Page 17: Only JavaScript, only Meteor.js

Node.js frameworks

- Meteor.js- a lot of killer features- easy to learn- good documentation- large passionate community

Page 18: Only JavaScript, only Meteor.js

Node.js frameworks

- Meteor.js- a lot of killer features- easy to learn- good documentation- large passionate community- a lot of learning resources

Page 19: Only JavaScript, only Meteor.js

What is Meteor?

Full stack JavaScript platform for building real-time applications.

Built on top of Node.js

Page 20: Only JavaScript, only Meteor.js

Meteor.js (killer) features

- Live reload - forget about F5

Page 21: Only JavaScript, only Meteor.js

Meteor.js (killer) features

- Live reload - forget about F5- Automatic CSS and JS minification on

production server

Page 22: Only JavaScript, only Meteor.js

Meteor.js (killer) features

- No need to include CSS, JS files manually

<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />

...

<script src="bower_components/jquery/dist/jquery.js"></script>

...

Page 23: Only JavaScript, only Meteor.js

Meteor.js (killer) features

- Real-time by default

Messages = new Mongo.Collection(‘messages’);Messages.insert({ text: ‘Hello Meteor’, timestamp: Date.now() });

Page 24: Only JavaScript, only Meteor.js

Meteor.js (killer) features

- Built in client-side technologies- Templates, Helpers, Events, Session

Page 25: Only JavaScript, only Meteor.js

Meteor.js (killer) features

- Built in client-side technologies

Template.hello.helpers({ counter: function() { return Session.get(‘counter’); }});

Page 26: Only JavaScript, only Meteor.js

Meteor.js (killer) features

- Built in client-side technologies

<template name=”hello”> <button class=”increase-counter”>Click me</button>

<p>You clicked {{counter}} times</p></template>

Page 27: Only JavaScript, only Meteor.js

Meteor.js (killer) features

- Built in client-side technologies

Template.hello.events({ ‘click .increase-counter’: function(evt, tpl) { Session.set(‘counter’, Session.get(‘counter’) + 1); }});

Page 28: Only JavaScript, only Meteor.js

Meteor.js (killer) features

- MiniMongo

//client-side codevar messagesFromFuture = Messages.find({

timestamp: { $gt: Date.now() }});

Page 29: Only JavaScript, only Meteor.js

Meteor.js (killer) features

- Latency compensation- instant feedback for user interaction

Page 30: Only JavaScript, only Meteor.js

Meteor.js (killer) features

- Package manager

$ meteor add accounts-ui accounts-password

Page 31: Only JavaScript, only Meteor.js

Meteor.js (killer) features

- Package manager

$ meteor add accounts-ui accounts-password

<template name=”hello”><h1>Sign in / Sign up:</h1>{{> loginButtons}}

</template>

Page 32: Only JavaScript, only Meteor.js

Meteor.js (killer) features

- Package manager

$ meteor add less$ meteor add coffeescript

atmospherejs.com

Page 33: Only JavaScript, only Meteor.js

Meteor.js (killer) features

- Package manager- You can also use NPM

Page 34: Only JavaScript, only Meteor.js

Meteor.js (killer) features

- Built in authentication/registration- Email, Facebook, Twitter, Google, Github,...

$ meteor add service-configuration

$ meteor add accounts-facebook

Page 35: Only JavaScript, only Meteor.js

Meteor.js (killer) features

- Built in authentication/registration- Email, Facebook, Twitter, Google, Github,...

ServiceConfiguration.configurations.insert({

service: "facebook",

appId: "yourAppId",

secret: "yourSecret"

});

Page 36: Only JavaScript, only Meteor.js

Meteor.js (killer) features

- Built in authentication/registration- Email, Facebook, Twitter, Google, Github,...

Meteor.loginWithFacebook();

Page 37: Only JavaScript, only Meteor.js

Meteor.js (killer) features

- Easy deployment

$ meteor deploy appname

http://www.appname.meteor.com

Page 38: Only JavaScript, only Meteor.js

Meteor.js (killer) features

- Easy deployment- Meteor up package

$ npm install -g mup

$ cd /app-folder

$ mup init

$ mup deploy

Page 39: Only JavaScript, only Meteor.js

Meteor.js (killer) features

- Mobile apps in Meteor (Android, iOS)

$ meteor install-sdk android

$ meteor add-platform android$ meteor run android

Page 40: Only JavaScript, only Meteor.js

Specialities

Publish/Subscribe

//server

Metor.publish(“userTasks", function () {

return Tasks.find({ userId: this.userId });

});

//client

Meteor.subscribe(“userTasks”);

Page 41: Only JavaScript, only Meteor.js

Specialities

Autopublish, Insecure package

$ meteor remove autopublish

$ meteor remove insecure

Page 42: Only JavaScript, only Meteor.js

Specialities

Directory structureapp/

client/

lib/

public/

server/

...

Page 43: Only JavaScript, only Meteor.js

Meteor.js caveats

- Only MongoDB support at this time.

Page 44: Only JavaScript, only Meteor.js

Meteor.js community

Page 45: Only JavaScript, only Meteor.js

Meteor.js community

https://forums.meteor.com/

Page 46: Only JavaScript, only Meteor.js

My Meteor applications

TodoToday http://todotoday.meteor.com/ (OS)

Page 47: Only JavaScript, only Meteor.js

My Meteor applications

Seenist http://seenist.com/

Page 48: Only JavaScript, only Meteor.js

My Meteor applications

Typefast http://typefast.meteor.com/ (OS)

Page 49: Only JavaScript, only Meteor.js

My Meteor applications

FasterChat https://fasterchat.com (OS)

Page 50: Only JavaScript, only Meteor.js

My Meteor applications

CoderMania http://codermania.com

Page 51: Only JavaScript, only Meteor.js

Learning resources● Official Meteor web: http://meteor.com● Meteorhacks: http://meteorhacks.com● E-book: https://www.discovermeteor.com● Meteor screencasts: https://www.eventedmind.com● Video courses on Udemy: https://www.udemy.com● Meteor packages: https://atmospherejs.com● My Meteor blog: http://meteor.hromnik.com● Twitter: @meteorjs, #meteorjs

Page 52: Only JavaScript, only Meteor.js

Only JavaScript, only Meteor.js

Try to build an application in Meteor

Tomáš Hromník (@elfoslav) www.hromnik.com