server side javascript : how to start ?
DESCRIPTION
Slides for my NantesJS TalkTRANSCRIPT
Server-side javascript
how to start ?
Confoo 2011 remix NantesJS
– Quentin ADAM @waxzce
$: w
hoam
i
Quentin ADAM
@waxzce on
twitter or github
CEO at Clever
Cloud
JavascriptWhere ? When ? Why ?
What
are
we d
oin
g
wit
h Java
scri
pt
today
? Application server
Database
Browser
RIA
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.
The p
olyg
lotte
situatio
nClient
Javascript• Controller
HTML• Model
CSS• View
Server
Php
Java
Perl
Ruby
Scala
Groovy
.net
Brainf*ck
….
About polyglots
and languages
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
Some strengths for
modern and social apps
Event driven
NoSQL & Json
Use some data with unknow
format
One la
nguage,
seve
ral e
ngin
es
Rem
inds
me o
f so
meth
ing …
A s
tandard
(or
not)
&
Many
imple
menta
tions
(or
not)
Engine =
Tools compiling to bytecode + conversion
to binary instructions=
Javascript virtual machine
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
engin
e JS
≠ B
row
ser
Engine Browser
…
Rendering
DOM
API
JS -> binary
Define standard utils & lang
No D
OM
No jquery
No mootools
No dojo…
Except server
versions
A w
eb s
erv
er
HTTPRequest• Client
HTTPResponse• Server
RESTful
One of the biggest changes of ssjs :
event driven web response, async
0_0Don’t panic, some schema next slide
wit
hout
New HTTP
request is here
Routing work
Proccess the
response blocking thread
Send the HTTP
response
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
What
do w
e
need ?
VM javascrip
t
Useful API
http request handler
Server side
ready
Some toolsNames
Aja
x Push
Engin
e
Designed for real time
web
Stable and strong project
Mootools framework
Mysql support
http://www.ape-project.org/
How
to ?
Mongo D
B
Document oriented
database
Store data as Bson
Lots of platforms
supported
Map re
duce
A new way for geting data
working on a lot of noSQL DB
Node.js : T
he
Sta
r
How
to ?
Entry point file
fram
ew
orks
node
Sinatra like : express
Rails like : Geddy
!! -> tools are not ready
Ruby & node.js
Com
monJS
Some specs
for all this
f*cking mess
require()
http://www.commonjs.org/
How to begin ?And be happy with new tools
Cre
ate
a g
ithub
acc
ount All ssJs projects
are on github Frameworks, mods too Examples You need it anyway
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
Test
node.js
wit
h
cloud9
Online IDE for node.js Nothing to install Works with github
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
Pla
y w
ith m
ongoD
B
or
couch
DB
Easy to install Useful Ssjs platform integration
Inst
all
APE
test
it
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
Wri
te s
om
e
kick
ass
apps
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
Thx