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
460
Building the GitHub workspace app
bkeepers
PRO
1
340
Contributing to Your Career
bkeepers
PRO
3
700
A Maturity Model for Embracing Open Source Software
bkeepers
PRO
3
900
Open Source Principles for Internal Engineering Teams
bkeepers
PRO
7
1.3k
Carbon, Automobiles, Bebop & Fashion
bkeepers
PRO
1
510
Tending Your Open Source Garden, v2
bkeepers
PRO
1
570
Tending Your Open Source Garden
bkeepers
PRO
2
950
The Loyal Renegade
bkeepers
PRO
3
840
Other Decks in Programming
See All in Programming
20250326_生成AIによる_レビュー承認システムの実現.pdf
takahiromatsui
15
4.6k
AI時代のプログラミング教育 / programming education in ai era
kishida
22
20k
S3静的ホスティング+Next.js静的エクスポート で格安webアプリ構築
iharuoru
0
190
Windows版PHPのビルド手順とPHP 8.4における変更点
matsuo_atsushi
0
360
イベントソーシングによってインピーダンスミスマッチから解放された話
tkawae
1
310
PHPでお金を扱う時、終わりのない 謎の1円調査の旅にでなくて済む方法
nakka
3
960
Preact、HooksとSignalsの両立 / Preact: Harmonizing Hooks and Signals
ssssota
1
240
爆速スッキリ! Rspack 移行の成果と道のり - Muddy Web #11
dora1998
0
140
RailsでCQRS/ESをやってみたきづき
suzukimar
2
1.5k
Identifying and Analyzing Fake OSS with Malware - fukuoka.go#21
rhykw
0
530
ニックトレイン登壇資料
ryotakurokawa
0
130
家族・子育て重視/沖縄在住を維持しながらエンジニアとしてのキャリアをどのように育てていくか?
ug
0
220
Featured
See All Featured
Designing for humans not robots
tammielis
250
25k
BBQ
matthewcrist
88
9.5k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
Speed Design
sergeychernyshev
28
850
Embracing the Ebb and Flow
colly
84
4.6k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
134
33k
How STYLIGHT went responsive
nonsquared
99
5.4k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
40
2k
The Invisible Side of Design
smashingmag
299
50k
Building Applications with DynamoDB
mza
94
6.3k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5.4k
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