s h a k ra s a nd h o t s to n e t h e ra py ( s h s t )€¦ · java -xmx4g -xms4g -jar app.jar::...

82
Shakras and Hot Stone Therapy (SHST) Shakras and Hot Stone Therapy (SHST) Modern techniques for relaxation using ancient methods Modern techniques for relaxation using ancient methods (a hands-on approach) (a hands-on approach) 1.1

Upload: others

Post on 17-May-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Shakras and Hot Stone Therapy (SHST)Shakras and Hot Stone Therapy (SHST)

Modern techniques for relaxation using ancient methodsModern techniques for relaxation using ancient methods

(a hands-on approach)(a hands-on approach)

1 . 1

Page 2: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Server Architectures with NodeServer Architectures with Node

Why should the browser folk have all the fun?Why should the browser folk have all the fun?

1 . 2

Page 3: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Your friendly presenterYour friendly presenter

Jeffrey [email protected], Chariot SolutionsSomewhat Recent Javascript Convert

1 . 3

Page 4: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Javascript Convert?Javascript Convert?

1 . 4

Page 5: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Javascript Convert?Javascript Convert?

Actually, yesActually, yes

1 . 4

Page 6: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

However, there's beauty in thereHowever, there's beauty in there

1 . 5

Page 7: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

However, there's beauty in thereHowever, there's beauty in there

This may take a bit of time to �nd.This may take a bit of time to �nd.

1 . 5

Page 8: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

E�cient use of resources makes me happy.E�cient use of resources makes me happy.

2 . 1

Page 9: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

E�cient use of resources makes me happy.E�cient use of resources makes me happy.

(hapi?)

2 . 1

Page 10: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

This thing is This thing is thinthin

2 . 2

Page 11: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Customer production server from pm2:

$ pm2 status │ SERVER (PROD) │ online | 12D │ 0% │ 148.7 MB |

2 . 3

Page 12: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Customer production server from pm2:

12 days of uptime12 days of uptime

$ pm2 status │ SERVER (PROD) │ online | 12D │ 0% │ 148.7 MB |

2 . 3

Page 13: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Customer production server from pm2:

12 days of uptime12 days of uptime

150MB of RAM!150MB of RAM!

$ pm2 status │ SERVER (PROD) │ online | 12D │ 0% │ 148.7 MB |

2 . 3

Page 14: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

java -Xmx4G -Xms4G -jar app.jar

:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for 24.811)

2 . 4

Page 15: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Single threadedSingle threaded

2 . 5

Page 16: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Code isomorphism between client and serverCode isomorphism between client and server

If you use JS on the client...If you use JS on the client...

2 . 6

Page 17: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Fun to write, to be honestFun to write, to be honest

2 . 7

Page 18: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

JS is a gateway drug to LambdaJS is a gateway drug to Lambda

2 . 8

Page 19: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Node architecture makes me happyNode architecture makes me happy

3 . 1

Page 20: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Node architecture makes me happyNode architecture makes me happy

(hapi?)

3 . 1

Page 21: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Node was born from two neat pieces ofNode was born from two neat pieces oftechnologytechnology

3 . 2

Page 22: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Node was born from two neat pieces ofNode was born from two neat pieces oftechnologytechnology

libuvlibuv

3 . 2

Page 23: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Node was born from two neat pieces ofNode was born from two neat pieces oftechnologytechnology

libuvlibuv

v8v8

3 . 2

Page 24: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

3 . 3

Page 25: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

3 . 4

Page 26: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

v8v8 & & shakrashakra

3 . 5

Page 27: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

libuvlibuv

3 . 6

Page 28: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Only a matter of timeOnly a matter of time

3 . 7

Page 29: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

What, exactly, is it good for?What, exactly, is it good for?

3 . 8

Page 30: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

IOIO

3 . 9

Page 31: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

IOIO

Like, Like, tonstons of IO of IO

3 . 9

Page 32: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

3 . 10

Page 33: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Try not to do too muchTry not to do too much

All CPU use on node is crimethinkAll CPU use on node is crimethink

Get in, get outGet in, get out

3 . 11

Page 34: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

A humorous vingette...A humorous vingette...

3 . 12

Page 35: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

bcrypt(3)bcrypt(3)!!!!!!!!!!

3 . 13

Page 36: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

WARNING:WARNING:

Handrails are not availableHandrails are not available

3 . 14

Page 37: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

There really is only one real method in nodeThere really is only one real method in nodethat matters.that matters.

3 . 15

Page 38: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

There really is only one real method in nodeThere really is only one real method in nodethat matters.that matters.

on()on()

3 . 15

Page 39: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

3 . 16

Page 40: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Looks familiar?Looks familiar?

server.on('request', (req, res) => { // node HTTP server }) observer.subscribe((x) => { // Angular HttpClient })

3 . 17

Page 41: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

The fundamental unit of javascript is theThe fundamental unit of javascript is thecontinuationcontinuation..

Javascript is a Javascript is a continuation orientedcontinuation orientedlanguage.language.

3 . 18

Page 42: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

whenItIsDone(thing, (result) => { doSomethingElse(result) })

3 . 19

Page 43: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

const fs = require('fs') fs.readFile('./foo.txt', 'utf8', (err, contents) => { console.log(contents) });

3 . 20

Page 44: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

The The continuationcontinuation is a lambda is a lambda

3 . 21

Page 45: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

The The continuationcontinuation is a lambda is a lambda

It executes later.It executes later.

3 . 21

Page 46: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

The The continuationcontinuation is a lambda is a lambda

It executes later.It executes later.

You can never get here from there.You can never get here from there.

3 . 21

Page 47: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

(err, contents) => { console.log(contents) });

3 . 22

Page 48: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

fs.readFile('./foo.txt', 'utf8', (err, contents) => { console.log(contents) }); fs.readFile('./bar.txt', 'utf8', (err, contents) => { console.log(contents) });

3 . 23

Page 49: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

This is the beauty of nodejsThis is the beauty of nodejs

Handle your result Handle your result

3 . 24

Page 50: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

This is the beauty of nodejsThis is the beauty of nodejs

Handle your result Handle your result laterlater

3 . 24

Page 51: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Man, it can get ugly fastMan, it can get ugly fast

4 . 1

Page 52: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

const fs = require('fs') const dns = require('net') fs.readFile('./foo.txt', 'utf8', (err, contents) => { fs.writeFile('./bar.txt', 'utf8', (err, contents) => { dns.lookup(contents, (err, address, family) => { console.log(address) }) }) })

4 . 2

Page 53: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

do(foo, bar => { some(bar, baz => { thing(baz, quux => { complex(quux, quuz => { eventually(quuz, waldo => { go(waldo, fred => { crazy(fred, thud => { console.log(thud) }) }) }) }) }) }) })

4 . 3

Page 54: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Promises are syntactic sugarPromises are syntactic sugar

4 . 4

Page 55: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

do(foo) .then(bar => { some(bar) }).then(baz => { thing(baz) }).then(quux => { complex(quux) }).then(quuz => { eventually(quuz) }).then(waldo => { go(waldo) }).then(fred => { crazy(fred) }).then(thud => { console.log(thud)

4 . 5

Page 56: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

asyncasync / / awaitawait are the new hotness are the new hotness

4 . 6

Page 57: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

try{ const bar = await do(foo) const baz = await some(bar) const quux = await thing(baz) const quuz = await complex(quux) const waldo = await eventually(quuz) const fred = await go(waldo) const thud = await crazy(fred) console.log(thud) }catch(err){ // whoops }

4 . 7

Page 58: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

const p = do(foo); const bar = await p;

4 . 8

Page 59: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

const util = require('util') const readFileAsync = util.promisify(fs.readFile) const contents = await readFileAsync('./foo.txt', 'utf8')

4 . 9

Page 60: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

4 . 10

Page 61: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

4 . 11

Page 62: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

const f = (a, b) => { return a + b } const p = f('a', ?) assert(p('b') === 'ab')

4 . 12

Page 63: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Let's do some actual Let's do some actual workwork..

5 . 1

Page 64: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

REST serversREST servers

ExpressHAPIRestifyLoopbackSails... probably a baker's dozen more by now

5 . 2

Page 65: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Express.js is the gold standardExpress.js is the gold standard

Does whatcha needDoes whatcha need

5 . 3

Page 66: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

const express = require('express') const app = express() const port = 80 app.get('/', (req, res) => res.send('Hello World!')) app.listen(port, () => console.log(`Example app listening on por

5 . 4

Page 67: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

C'mon get HAPIC'mon get HAPI

5 . 5

Page 68: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

[email protected]:chariotspaday/[email protected]:chariotspaday/server.git

5 . 6

Page 69: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Things to likeThings to like

In this desolate wasteland of In this desolate wasteland of ~0.0.9~0.0.9

5 . 7

Page 70: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Vibrant plugins, easy API to write your ownVibrant plugins, easy API to write your own

goodboomnescon�dencepoopbellblipp

5 . 8

Page 71: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

server.route({ method: 'GET', path: '/', handler: function (request, h) { return 'Hello!' } })

5 . 9

Page 72: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

hapi ❤ joihapi ❤ joi

const session = joi.object().keys({ id: joi.number().integer().min(1).required(), name: joi.string().trim(true).min(1).required(), date: joi.string().trim(true).isoDate().required() })

5 . 10

Page 73: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

method: 'GET', options: { tags: ['api'], description: 'Gets all subscriptions for a session', path: '/session/{id}/subscriptions', validate: { params: { id: joi.number().integer().min(1) } },

5 . 11

Page 74: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

response: { options: { abortEarly: false }, sample: 100, schema: joi.array().items(joiSchemas.registration) }

5 . 12

Page 75: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

"/api/session": { "get": { "responses": { "default": { "description": "", "schema": { "type": "array", "items": { "$ref": "#/definitions/IdNameDateModel" } } } }, "produces": ["application/json"], "tags": ["api"],

5 . 13

Page 76: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for
Page 77: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

5 . 14

Page 78: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Stupid node tricks with hapi, express, andStupid node tricks with hapi, express, andwebsocketswebsockets

5 . 15

Page 79: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

const hapi = require('hapi') const ws = require('ws') const server = new hapi.Server({port: 8000}) const listener = server.listener const wss = new WebSocket.Server({ server: listener, path: '/api/chat' }) await server.start()

5 . 16

Page 80: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

this._removeListeners = addListeners(this._server, { listening: this.emit.bind(this, 'listening'), error: this.emit.bind(this, 'error'), upgrade: (req, socket, head) => { this.handleUpgrade(req, socket, head, (ws) => { this.emit('connection', ws, req); }); } });

5 . 17

Page 81: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

server.events.on('log', (event, tags) => { server.events.on('request', (request, event, tags) => { server.events.on('response', (request) => {

5 . 18

Page 82: S h a k ra s a nd H o t S to n e T h e ra py ( S H S T )€¦ · java -Xmx4G -Xms4G -jar app.jar:: Spring Boot :: (v2.0.3.RELEASE) Started TestApp in 24.351 seconds (JVM running for

Takeaway (whew!)Takeaway (whew!)

Understand on()Grok continuations, how code moves through nodeNever eat CPU.Use cool language featuresBe Javascripty on the server

6