Download - Getting Started with Node.JS with Derek Watson

Transcript
Page 1: Getting Started with Node.JS with Derek Watson

Intro to Node.js Derek Watson

Mar 29, 2014

Page 2: Getting Started with Node.JS with Derek Watson

Story time!

JavaScript

Pretty cool language #javascript

The Working Group

Software shop @twg

Derek Watson

Developer guy @dcwca

and me

Page 3: Getting Started with Node.JS with Derek Watson

what is it good for?

Page 4: Getting Started with Node.JS with Derek Watson

What is it good for?

• JSON APIs

#twg@twg

Page 5: Getting Started with Node.JS with Derek Watson

What is it good for?

• JSON APIs

• Network servers

#twg@twg

Page 6: Getting Started with Node.JS with Derek Watson

What is it good for?

• JSON APIs

• Network servers

• Realtime applications

#twg@twg

Page 7: Getting Started with Node.JS with Derek Watson

!

MODULES

Page 8: Getting Started with Node.JS with Derek Watson

everything is a module

Page 9: Getting Started with Node.JS with Derek Watson

Modules everywhere

• Your app code is written as modules

• Libraries you use are modules

• Your whole app is one big module

#twg@twg

Page 10: Getting Started with Node.JS with Derek Watson

doge.js: An example module

#twg@twg

Page 11: Getting Started with Node.JS with Derek Watson

doge.js

Page 12: Getting Started with Node.JS with Derek Watson

program.js

Page 13: Getting Started with Node.JS with Derek Watson

Try it out!

Page 14: Getting Started with Node.JS with Derek Watson

“The main thing that distinguishes legacy code is a lack of tests.”

- Michael Feathers

Page 15: Getting Started with Node.JS with Derek Watson

test/doge.js

Page 16: Getting Started with Node.JS with Derek Watson

test/doge.js

Page 17: Getting Started with Node.JS with Derek Watson

test/doge.js

Page 18: Getting Started with Node.JS with Derek Watson
Page 19: Getting Started with Node.JS with Derek Watson

server.js

Page 20: Getting Started with Node.JS with Derek Watson

server.js

Page 21: Getting Started with Node.JS with Derek Watson

Try it out!

Page 22: Getting Started with Node.JS with Derek Watson

server.js

Page 23: Getting Started with Node.JS with Derek Watson

package.json

Page 24: Getting Started with Node.JS with Derek Watson

Module Learnings

• Write some code

• Export: module.exports = { say: say }

• Import: var doge = require(‘../doge’)

• Write some tests

• Compose modules into apps

• The outside world: package.json

#twg@twg

Page 25: Getting Started with Node.JS with Derek Watson

NODE.JS API

Page 26: Getting Started with Node.JS with Derek Watson
Page 27: Getting Started with Node.JS with Derek Watson

QUALITY: • Very well documented • Almost completely stable • Moving towards 1.0

!QUANTITY:

• As small as possible • You can learn it in a day or two

Core API

#twg@twg

Page 28: Getting Started with Node.JS with Derek Watson

NODE PACKAGE MANAGER

Page 29: Getting Started with Node.JS with Derek Watson

65,000 packages

Page 30: Getting Started with Node.JS with Derek Watson
Page 31: Getting Started with Node.JS with Derek Watson

But which packages are good?

• Learn to sniff out the quality

• Read npm’s Most Starred, Most Required

• Build your own bag of tricks

#twg@twg

Page 32: Getting Started with Node.JS with Derek Watson

express, restify jade, stylus

mongoose, sequelize async, q

ws, primus mocha, chai

yargs bunyan forever

Page 33: Getting Started with Node.JS with Derek Watson

“It’s not what you know, it’s who you know”

- Abraham Lincoln

Page 34: Getting Started with Node.JS with Derek Watson

substack

caolanbriancv1feross

tjholowaychuk isaacs henrikjoreteg

Page 35: Getting Started with Node.JS with Derek Watson
Page 36: Getting Started with Node.JS with Derek Watson

Node.js is General-Purpose

• Conventional web apps

#twg@twg

Page 37: Getting Started with Node.JS with Derek Watson

Node.js is General-Purpose

• Conventional web apps

• Realtime web apps

#twg@twg

Page 38: Getting Started with Node.JS with Derek Watson

Node.js is General-Purpose

• Conventional web apps

• Realtime web apps

• Cross-platform desktop apps

#twg@twg

Page 39: Getting Started with Node.JS with Derek Watson

Node.js is General-Purpose

• Conventional web apps

• Realtime web apps

• Cross-platform desktop apps

• Network servers

#twg@twg

Page 40: Getting Started with Node.JS with Derek Watson

CONTROL ROBOTS

#twg@twg

Page 41: Getting Started with Node.JS with Derek Watson

Inclusive, friendly people who are open to learning and teaching

!Toronto Node.JS Meetup

Currently hosted at the TWG studio !

Amazing conferences Such as this one! And many others

Vibrant Community

#twg@twg

Page 42: Getting Started with Node.JS with Derek Watson

#twg@twg

NodeUp Podcast - Team Episodes

Page 43: Getting Started with Node.JS with Derek Watson

#twg@twg

Node.js Low barrier to entry

Simple

Powerful

BE EXCITEDbe, be excited

Page 44: Getting Started with Node.JS with Derek Watson

QUESTIONS?

Email: [email protected]

Twitter: @dcwca

Page 45: Getting Started with Node.JS with Derek Watson

Thank You.