Introduction to RethinkDB and Horizon.js
-
Upload
chuck-hayes -
Category
Technology
-
view
1.476 -
download
0
Transcript of Introduction to RethinkDB and Horizon.js
![Page 1: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/1.jpg)
RethinkDB, horizon
RethinkDB, horizon
Introduction to create the real time web application.
![Page 2: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/2.jpg)
RethinkDB, horizon
About me
![Page 3: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/3.jpg)
@chuck0523
25yo like JavaScript
Junior Front-End developer
![Page 4: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/4.jpg)
0
25
50
75
100
HTML CSS JavaSript Ruby PHP
RethinkDB, horizon
My skills
![Page 5: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/5.jpg)
RethinkDB, horizon
My recent job
‣ Create SPA by React, Redux, CSS Modules, PostCSS with Webpack, on Rails as API server.
![Page 6: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/6.jpg)
RethinkDB, horizon
It’s on Medium
![Page 7: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/7.jpg)
RethinkDB, horizon
That’s it about me
![Page 8: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/8.jpg)
RethinkDB, horizon
Let’s dive into RethinkDB & horizon!!
![Page 9: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/9.jpg)
The open-source database
for the realtime web
RethinkDB, horizon
RethinkDB
![Page 10: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/10.jpg)
RethinkDB, horizon
RethinkDB
‣ OpenSource NoSQL DB
‣ Since July 2009
‣ For realtime web app
‣ Written in C++
‣ Stores JSON
‣ 15000 stars on Github
![Page 11: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/11.jpg)
RethinkDB, horizon
ReQL
RethinkDB is using ReQL (DSL)
Available in Java, Ruby, Python, JavaScript
![Page 12: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/12.jpg)
RethinkDB, horizon
SQL to ReQL
Insert in SQL
![Page 13: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/13.jpg)
RethinkDB, horizon
SQL to ReQL
Insert in ReQL
![Page 14: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/14.jpg)
RethinkDB, horizon
Select statement
SQL ReQL
![Page 15: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/15.jpg)
RethinkDB, horizon
Update statement
SQL ReQL
![Page 16: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/16.jpg)
RethinkDB, horizon
Delete statement
SQL ReQL
![Page 17: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/17.jpg)
RethinkDB, horizon
Joins in ReQL
![Page 18: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/18.jpg)
RethinkDB, horizon
Aggregation in ReQL
“Group by” in SQL
![Page 19: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/19.jpg)
RethinkDB, horizon
Totally NoSQL.
Seems to be super easy and fun!
![Page 20: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/20.jpg)
RethinkDB, horizon
That’s all about ReQL
![Page 21: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/21.jpg)
RethinkDB, horizon
How can we start ?
![Page 22: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/22.jpg)
RethinkDB, horizon
$ brew install rethinkdb
![Page 23: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/23.jpg)
RethinkDB, horizon
RethinkDB in Rails
https://www.rethinkdb.com/docs/rails/
![Page 24: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/24.jpg)
RethinkDB, horizon
RethinkDB in Others
https://github.com/rethinkdb/?utf8=%E2%9C
You can also use Angular, Express, Node…
![Page 25: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/25.jpg)
The realtime JavaScript backend
RethinkDB, horizon
Horizon.js
![Page 26: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/26.jpg)
RethinkDB, horizon
Horizon.js
‣ OSS JavaScript Framework
‣ Created by RethinkDB ppl
‣ On RethinkDB and Node.js
‣ Subscribes App state
‣ Using RxJS Internally
‣ Auth and Permission
![Page 27: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/27.jpg)
RethinkDB, horizon
Let’s take a look at sample code
![Page 28: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/28.jpg)
RethinkDB, horizon
Two core classes in Horizon.js
![Page 29: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/29.jpg)
RethinkDB, horizon
1. Horizon class
‣ Horizon class takes care of instantiation and management connection
‣ Pass a string to object of Horizon class, then collection is returned
![Page 30: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/30.jpg)
RethinkDB, horizon
1. Horizon class
![Page 31: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/31.jpg)
RethinkDB, horizon
2. Collection class
‣ Collection class deals with create, read, update and delete data
‣ Some methods return RxObservable, which enables us to use RxObservable’s methods
![Page 32: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/32.jpg)
RethinkDB, horizon
Collection.store
![Page 33: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/33.jpg)
RethinkDB, horizon
Collection.watch
![Page 34: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/34.jpg)
RethinkDB, horizon
Rx returnable methods
‣ Collection.watch returns RxObservable
‣ We can use RxObservable’s method
‣ map, filter, mergeMap, toArray…
![Page 35: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/35.jpg)
RethinkDB, horizon
Collection.methods are for Back-end (RethinkDB).
RxObservable.methods are for Front-end (React or something).
![Page 36: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/36.jpg)
RethinkDB, horizon
https://www.rethinkdb.com/docs/sharding-and-replication/
We got basic of RethinkDB & Horizon.js now
http://horizon.io/docs/getting-started/
![Page 37: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/37.jpg)
RethinkDB, horizon
It’s time to DEMO
![Page 38: Introduction to RethinkDB and Horizon.js](https://reader034.fdocuments.us/reader034/viewer/2022042907/58732aa51a28ab596c8b57f3/html5/thumbnails/38.jpg)
RethinkDB, horizon
Thanks for listening
Codes of DEMO are on Github repo. You can pull and try it.
https://github.com/chuck0523/learning-langs/tree/gh-pages/js/reChat