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
34
1.6k
Node.js Introduction
A brief introduction to Node.js given at the
Grand Rapids Web Development Group
.
Brandon Keepers
PRO
March 26, 2012
Tweet
Share
More Decks by Brandon Keepers
See All by Brandon Keepers
Automating Software Development
bkeepers
PRO
3
550
Building the GitHub workspace app
bkeepers
PRO
1
440
Contributing to Your Career
bkeepers
PRO
4
790
A Maturity Model for Embracing Open Source Software
bkeepers
PRO
3
970
Open Source Principles for Internal Engineering Teams
bkeepers
PRO
8
1.4k
Carbon, Automobiles, Bebop & Fashion
bkeepers
PRO
1
600
Tending Your Open Source Garden, v2
bkeepers
PRO
1
670
Tending Your Open Source Garden
bkeepers
PRO
2
1k
The Loyal Renegade
bkeepers
PRO
3
1k
Other Decks in Programming
See All in Programming
Rust 製のコードエディタ “Zed” を使ってみた
nearme_tech
PRO
0
200
ぼくの開発環境2026
yuzneri
0
240
Lambda のコードストレージ容量に気をつけましょう
tattwan718
0
140
高速開発のためのコード整理術
sutetotanuki
1
400
AI & Enginnering
codelynx
0
120
カスタマーサクセス業務を変革したヘルススコアの実現と学び
_hummer0724
0
720
CSC307 Lecture 08
javiergs
PRO
0
670
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
600
登壇資料を作る時に意識していること #登壇資料_findy
konifar
4
1.4k
20260127_試行錯誤の結晶を1冊に。著者が解説 先輩データサイエンティストからの指南書 / author's_commentary_ds_instructions_guide
nash_efp
1
980
Basic Architectures
denyspoltorak
0
680
AI Agent の開発と運用を支える Durable Execution #AgentsInProd
izumin5210
7
2.3k
Featured
See All Featured
Darren the Foodie - Storyboard
khoart
PRO
2
2.4k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
250
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
170
Navigating Weather and Climate Data
rabernat
0
110
Joys of Absence: A Defence of Solitary Play
codingconduct
1
290
The Invisible Side of Design
smashingmag
302
51k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
1
100
Building Adaptive Systems
keathley
44
2.9k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
440
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.8k
So, you think you're a good person
axbom
PRO
2
1.9k
Writing Fast Ruby
sferik
630
62k
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