Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Node.js Introduction
Search
Brandon Keepers
PRO
March 26, 2012
Programming
1.7k
34
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Node.js Introduction
A brief introduction to Node.js given at the
Grand Rapids Web Development Group
.
Brandon Keepers
PRO
March 26, 2012
More Decks by Brandon Keepers
See All by Brandon Keepers
Automating Software Development
bkeepers
PRO
3
590
Building the GitHub workspace app
bkeepers
PRO
1
480
Contributing to Your Career
bkeepers
PRO
4
840
A Maturity Model for Embracing Open Source Software
bkeepers
PRO
3
1k
Open Source Principles for Internal Engineering Teams
bkeepers
PRO
8
1.5k
Carbon, Automobiles, Bebop & Fashion
bkeepers
PRO
1
670
Tending Your Open Source Garden, v2
bkeepers
PRO
1
720
Tending Your Open Source Garden
bkeepers
PRO
2
1.1k
The Loyal Renegade
bkeepers
PRO
3
1.1k
Other Decks in Programming
See All in Programming
才能?センス?知らん、 続けたもん勝ちだ。-- 結婚・出産・癌を越えてなお、私がプロダクトを創り続ける理由
16bitidol
1
130
Oxcを導入して開発体験が向上した話
yug1224
4
340
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
14
5.8k
Semantic Version 単位で戦略を柔軟に変えて、パッケージアップデートを自動化する
daitasu
1
300
キャリア迷子上等 ─ "ない道"は自分で作ればいい
16bitidol
3
2.3k
決定論的オーケストレーションの設計と実装 / Design and Implementation of Deterministic Orchestration
nrslib
4
1.5k
AIで効率化できた業務・日常
ochtum
0
140
Mujeres en SEO Summit 2026 - Greatest Disaster Hits en Web Performance
guaca
0
200
そのテスト、説明できますか?~LWテスト戦略FW~のご紹介
nakahara
0
160
1B+ /day規模のログを管理する技術
broadleaf
0
110
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
21
7k
Webフレームワークの ベンチマークについて
yusukebe
0
180
Featured
See All Featured
My Coaching Mixtape
mlcsv
0
150
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2k
What's in a price? How to price your products and services
michaelherold
247
13k
The untapped power of vector embeddings
frankvandijk
2
1.8k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Making Projects Easy
brettharned
120
6.7k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
360
Amusing Abliteration
ianozsvald
1
210
How to make the Groovebox
asonas
2
2.2k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
310
A better future with KSS
kneath
240
18k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
1k
Transcript
INTRODUCTION
Hi, I’m @bkeepers
None
nodejs.org Node.js is a platform built on Chrome's JavaScript runtime
for easily building fast, scalable network applications. Node.js uses an event-driven, non- blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
server side JavaScript
$ node webserver.js var http = require('http'), server = http.createServer();
server.on('request', function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n'); }); server.listen(1337, "127.0.0.1"); console.log('Server running at http://127.0.0.1:1337/'); webserver.js
None
event loop modules package management
non-blocking evented I/O
event driven
event driven Button
event driven Button
event driven Button $('button').on('click', function(event) { alert('Event Driven!') });
event driven server.on('request', function(req, res) { res.write(handleRequest(req)) });
non-blocking
None
// blocking var files = fs.readdirSync('/tmp') for(var i = 0;
i < files.length; i++) { var file = files[i]; fs.unlinkSync('/tmp/' + file); console.log('successfully deleted ' + file); }
// blocking var files = fs.readdirSync('/tmp') for(var i = 0;
i < files.length; i++) { var file = files[i]; fs.unlinkSync('/tmp/' + file); console.log('successfully deleted ' + file); } // non-blocking fs.readdir('/tmp', function(err, files) { for(var i = 0; i < files.length; i++) { var file = files[i]; fs.unlink('/tmp/' + file, function (err) { if (err) throw err; console.log('successfully deleted ' + file); }); } });
CommonJS modules
JavaScript Pollutes
JavaScript Pollutes string = "pollution";
None
var http = require('http');
hello.js module.exports = function() { return 'Hello World' };
$ node myapp.js myapp.js var hello = require('./hello.js'); console.log(hello());
package management
npmjs.org
$ npm install <package>
package.json
package.json $ npm install { "name": "myapp", "version": "0.0.1", "dependencies":
{ "socket.io": "0.8.7", "coffee-script": "1.2.0", "spine": "~1.0.5" } }
building the simplest chat app in the world demo
references
http://nodejs.org/api/
None
thanks! @bkeepers