Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Meteor.js
Search
Matthew Rudy Jacobs
August 08, 2012
Technology
3
1.7k
Meteor.js
My talk given at Codeaholics.hk on Wednesday 8th August 2012.
Matthew Rudy Jacobs
August 08, 2012
Tweet
Share
More Decks by Matthew Rudy Jacobs
See All by Matthew Rudy Jacobs
From Developer to Architect (and back again)
matthewrudy
3
220
Humans are Hard
matthewrudy
0
120
[Alpha] Humans Are Hard
matthewrudy
0
86
From Developer To Architect
matthewrudy
0
66
Git Commit Signing: Code we can trust?
matthewrudy
0
150
We Need To Talk About Postgres
matthewrudy
0
79
Coding as a Team At GoGoVan
matthewrudy
3
410
10 Years of Code
matthewrudy
0
98
Elixir - Part 1
matthewrudy
1
180
Other Decks in Technology
See All in Technology
Platform Engineering for Software Developers and Architects
syntasso
1
520
開発生産性を上げながらビジネスも30倍成長させてきたチームの姿
kamina_zzz
2
1.7k
ISUCONに強くなるかもしれない日々の過ごしかた/Findy ISUCON 2024-11-14
fujiwara3
8
870
New Relicを活用したSREの最初のステップ / NRUG OKINAWA VOL.3
isaoshimizu
2
610
SREによる隣接領域への越境とその先の信頼性
shonansurvivors
2
520
Amazon CloudWatch Network Monitor のススメ
yuki_ink
1
210
テストコード品質を高めるためにMutation Testingライブラリ・Strykerを実戦導入してみた話
ysknsid25
7
2.6k
rootlessコンテナのすゝめ - 研究室サーバーでもできる安全なコンテナ管理
kitsuya0828
3
390
OTelCol_TailSampling_and_SpanMetrics
gumamon
1
170
社内で最大の技術的負債のリファクタリングに取り組んだお話し
kidooonn
1
550
iOS/Androidで同じUI体験をネ イティブで作成する際に気をつ けたい落とし穴
fumiyasac0921
1
110
サイバーセキュリティと認知バイアス:対策の隙を埋める心理学的アプローチ
shumei_ito
0
390
Featured
See All Featured
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
4 Signs Your Business is Dying
shpigford
180
21k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
Agile that works and the tools we love
rasmusluckow
327
21k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Site-Speed That Sticks
csswizardry
0
26
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Gamification - CAS2011
davidbonilla
80
5k
Being A Developer After 40
akosma
86
590k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Six Lessons from altMBA
skipperchong
27
3.5k
Transcript
METEOR.JS 8th August 2012 - Codeaholics.hk @MatthewRudy
SOLR TAKEDA HOLMES
METEOR a javascript full stack framework compiles, combines, and distributes
your JS, CSS, and HTML deploys on the fly to users without interrupting their session
LEARN ABOUT IT http://docs.meteor.com https://github.com/siuying/todomvc-meteor `meteor create --example leaderboard`
7 PRINCIPLES marketing-style
#1 DATA ON THE WIRE no HTML rendered on the
server JSON sent to the browser the browser renders templates
#2 ONE LANGUAGE All code is Javascript (or maybe coffeescript)
#3 DATABASE EVERYWHERE Client Data API mirrors the Server Database
API the local data API looks just like Mongo
#4 LATENCY COMPENSATION All data operations take place in memory
first The callback to the server is asynchronous What happens if it fails?
#5 FULL STACK REACTIVITY Every thing has a callback Templates
re-render themselves automatically
#6 EMBRACE THE ECOSYSTEM Plug and Play Use Backbone or
whatever
#7 SIMPLICITY = PRODUCTIVITY Clean and Simple APIs
WHAT’S THE REAL DEAL?
COLLECTIONS # define Items = new Meteor.Collection “items” # insert
Items.insert {name: “giraffe”} # find Items.find {}, {sort: {name: 1}}
SESSIONS # get Session.get(“selected”) #set Session.set(“selected”, item._id) # check Session.equals(“selected”,
this._id)
HANDLEBARS <template name=”list”> <h1>Items</h1> <ul> {{#each items}} <li>{{> item }}</li>
{{/each}} </ul> </template>
TEMPLATES They automatically re-render when data changes!
TEMPLATES # {{> item }} <template name=”item”> <article class=”item”> {{name}}
</article> </template>
HELPERS {{#if selected}}selected{{/if}} Template.item.selected = -> Session.equals(“selected”, this._id)
{{pluralize itemCount “item” “items”}} Template.list.itemCount = -> Items.find({}).count() Template.list.pluralize =
(n, s, p) -> “#{n} #{if n == 1 then s else p}” HELPERS WITH ARGUMENTS
EVENTS Template.item.events = “click article”: -> Session.set(“selected”, this._id)
Item = new Meteor.collection “items” if Meteor.is_client Session.set(“selected”, null) if
Meteor.is_server Secret = 123 CLIENT + SERVER IN THE SAME FILE
CLIENT + SERVER IN FOLDERS client/some.js server/some.js shared.js
PACKAGES Backbone - Backbone on Client + Server Bootstrap -
Adds the Bootstrap CSS Coffeescript - Compiles .coffee files Handlebars - the default templating system
PACKAGES (AUTH) accounts - central API for accounts accounts-ui -
log in and sign up accounts-facebook - plug into facebook accounts-weibo - plug into weibo insecure - remove!
HTML CONCATENATION <body> <h1>The header</h1> </body> <body> <nav class=”navbar navbar-fixed-top”
/> </body>
TIME FOR A PLAY Live demo!
meteor create --example leaderboard
PROBLEMS there are quite a few
COMPLEXITY going beyond the basics things quickly get complex
NO NAMESPACE FOR TEMPLATES item_form item_list item_show content sidebar nav
AUTHENTICATION there is an “auth” branch but its hard to
use
BETTER TOOLS MRT is a good idea but frequently breaks
for me
BETTER DEBUG Coffee -> JS many JS files -> one
JS file => Big confusion
ROUTING Just use Backbone.Router?
TESTING? An afterthought
BUT...
ITS COOL Stuff magically works
THE FUTURE It’s awesome as a deployment tool Better integration
with Backbone and Angular
THANKS Any Questions?