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
470
Building the GitHub workspace app
bkeepers
PRO
1
350
Contributing to Your Career
bkeepers
PRO
4
710
A Maturity Model for Embracing Open Source Software
bkeepers
PRO
3
910
Open Source Principles for Internal Engineering Teams
bkeepers
PRO
8
1.3k
Carbon, Automobiles, Bebop & Fashion
bkeepers
PRO
1
520
Tending Your Open Source Garden, v2
bkeepers
PRO
1
580
Tending Your Open Source Garden
bkeepers
PRO
2
960
The Loyal Renegade
bkeepers
PRO
3
860
Other Decks in Programming
See All in Programming
小田原でみんなで一句詠みたいな #phpcon_odawara
stefafafan
0
350
KawaiiLT 登壇資料 キャリアとモチベーション
hiiragi
0
150
Exit 8 for SwiftUI
ojun9
0
140
大LLM時代にこの先生きのこるには-ITエンジニア編
fumiyakume
7
3.2k
Cursorを活用したAIプログラミングについて 入門
rect
0
110
状態と共に暮らす:ステートフルへの挑戦
ypresto
3
970
ComposeでWebアプリを作る技術
tbsten
0
120
MCP調べてみました! / Exploring MCP
uhzz
2
2.3k
実践Webフロントパフォーマンスチューニング
cp20
37
8.9k
Make Parsers Compatible Using Automata Learning
makenowjust
2
5.8k
Laravel × Clean Architecture
bumptakayuki
PRO
0
120
新しいPHP拡張モジュールインストール方法「PHP Installer for Extensions (PIE)」を使ってみよう!
cocoeyes02
0
420
Featured
See All Featured
The MySQL Ecosystem @ GitHub 2015
samlambert
251
12k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
The Invisible Side of Design
smashingmag
299
50k
Docker and Python
trallard
44
3.3k
What's in a price? How to price your products and services
michaelherold
245
12k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
760
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
129
19k
Statistics for Hackers
jakevdp
798
220k
Building an army of robots
kneath
305
45k
Building a Modern Day E-commerce SEO Strategy
aleyda
40
7.2k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.2k
Being A Developer After 40
akosma
91
590k
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