Server Side Javascript : how to start ?

41
Server-side javascript how to start ? Confoo 2 011 remix NantesJS – Quentin ADAM @waxzce

description

Slides for my NantesJS Talk

Transcript of Server Side Javascript : how to start ?

Page 1: Server Side Javascript : how to start ?

Server-side javascript

how to start ?

Confoo 2011 remix NantesJS

– Quentin ADAM @waxzce

Page 2: Server Side Javascript : how to start ?

$: w

hoam

i

Quentin ADAM

@waxzce on

twitter or github

CEO at Clever

Cloud

Page 3: Server Side Javascript : how to start ?

JavascriptWhere ? When ? Why ?

Page 4: Server Side Javascript : how to start ?

What

are

we d

oin

g

wit

h Java

scri

pt

today

? Application server

Database

Browser

RIA

Page 5: Server Side Javascript : how to start ?
Page 6: Server Side Javascript : how to start ?

His

tory

At the begining, Brendan Eich, created

Live Script (1995) at Netscape for server

usage. It is the Netscape Server procuct.

The Javascript name is

a maketing change by

Sun and Netscape.

Page 7: Server Side Javascript : how to start ?

The p

olyg

lotte

situatio

nClient

Javascript• Controller

HTML• Model

CSS• View

Server

Php

Java

Perl

Ruby

Scala

Groovy

.net

Brainf*ck

….

Page 8: Server Side Javascript : how to start ?

About polyglots

and languages

Page 9: Server Side Javascript : how to start ?

Share

som

e co

de

betw

een clie

nt a

nd

serve

r Unity of tools and

environment

Agile

Have the same

Model

No «  translations »

of objects

Page 10: Server Side Javascript : how to start ?

Some strengths for

modern and social apps

Event driven

NoSQL & Json

Use some data with unknow

format

Page 11: Server Side Javascript : how to start ?

One la

nguage,

seve

ral e

ngin

es

Rem

inds

me o

f so

meth

ing …

Page 12: Server Side Javascript : how to start ?

A s

tandard

(or

not)

&

Many

imple

menta

tions

(or

not)

Engine =

Tools compiling to bytecode + conversion

to binary instructions=

Javascript virtual machine

Page 13: Server Side Javascript : how to start ?

A s

tandard

(or

not)

&

Many

imple

menta

tions

(or

not)

{trace, spider, jäger…}Monkey

V8 M$ apple nitro Rhino Narcissus (zaphod)

dynJS & Nashorn

Page 14: Server Side Javascript : how to start ?

engin

e JS

≠ B

row

ser

Engine Browser

Rendering

DOM

API

JS -> binary

Define standard utils & lang

Page 15: Server Side Javascript : how to start ?

No D

OM

No jquery

No mootools

No dojo…

Except server

versions

Page 16: Server Side Javascript : how to start ?

A w

eb s

erv

er

HTTPRequest• Client

HTTPResponse• Server

RESTful

Page 17: Server Side Javascript : how to start ?

One of the biggest changes of ssjs :

event driven web response, async

0_0Don’t panic, some schema next slide

Page 18: Server Side Javascript : how to start ?

wit

hout

New HTTP

request is here

Routing work

Proccess the

response blocking thread

Send the HTTP

response

Page 19: Server Side Javascript : how to start ?

Wit

h

New HTTP

request is here

Work begins : event fired

Request marked

for waiting

Event listener handles

the request

Response contructio

n

Event «  it’s

done » fired

Send the

HTTP respons

e

Page 20: Server Side Javascript : how to start ?

What

do w

e

need ?

VM javascrip

t

Useful API

http request handler

Server side

ready

Page 21: Server Side Javascript : how to start ?

Some toolsNames

Page 22: Server Side Javascript : how to start ?

Aja

x Push

Engin

e

Designed for real time

web

Stable and strong project

Mootools framework

Mysql support

http://www.ape-project.org/

Page 23: Server Side Javascript : how to start ?

How

to ?

Page 24: Server Side Javascript : how to start ?

Mongo D

B

Document oriented

database

Store data as Bson

Lots of platforms

supported

Page 25: Server Side Javascript : how to start ?

Map re

duce

A new way for geting data

working on a lot of noSQL DB

Page 26: Server Side Javascript : how to start ?

Node.js : T

he

Sta

r

Page 27: Server Side Javascript : how to start ?
Page 28: Server Side Javascript : how to start ?

How

to ?

Entry point file

Page 29: Server Side Javascript : how to start ?

fram

ew

orks

node

Sinatra like : express

Rails like : Geddy

!! -> tools are not ready

Ruby & node.js

Page 30: Server Side Javascript : how to start ?

Com

monJS

Some specs

for all this

f*cking mess

require()

http://www.commonjs.org/

Page 31: Server Side Javascript : how to start ?

How to begin ?And be happy with new tools

Page 32: Server Side Javascript : how to start ?

Cre

ate

a g

ithub

acc

ount All ssJs projects

are on github Frameworks, mods too Examples You need it anyway

Page 33: Server Side Javascript : how to start ?

Have

a r

eal O

S

You need a real command

line interface You need compilation tools

You need it anyway UNIX

Tips : use ZSH with git

Page 34: Server Side Javascript : how to start ?

Test

node.js

wit

h

cloud9

Online IDE for node.js Nothing to install Works with github

Page 35: Server Side Javascript : how to start ?

Make

an o

pen

table

for

YQ

L SQL like language for

web APIs Works with ssjs Rhino

backend You only need a server

storing your table

Page 36: Server Side Javascript : how to start ?

Pla

y w

ith m

ongoD

B

or

couch

DB

Easy to install Useful Ssjs platform integration

Page 37: Server Side Javascript : how to start ?

Inst

all

APE

test

it

Page 38: Server Side Javascript : how to start ?

Incl

ude R

hin

o in

yo

ur

java

pro

ject

s Included in the JDK Useful for scripting Useful to work on

unsafe data Add an event layer with Atmoshpere or Akka

Page 39: Server Side Javascript : how to start ?

Wri

te s

om

e

kick

ass

apps

Page 40: Server Side Javascript : how to start ?

The ch

ecklist

What do I need ?

Can I split the

application ?

What about my

sysadmin skills ?

Is the app critical ?

Think about your problems with

these solutions

Page 41: Server Side Javascript : how to start ?

Thx