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.6k
34
Share
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
580
Building the GitHub workspace app
bkeepers
PRO
1
470
Contributing to Your Career
bkeepers
PRO
4
820
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
650
Tending Your Open Source Garden, v2
bkeepers
PRO
1
710
Tending Your Open Source Garden
bkeepers
PRO
2
1.1k
The Loyal Renegade
bkeepers
PRO
3
1k
Other Decks in Programming
See All in Programming
権限チェックの一貫性を型で守る TypeScript による多層防御
mnch
4
890
タクシーアプリ『GO』の バックエンド開発のおける AI利活用と若者のすべて
pyama86
3
1.7k
開発体験を左右するライブラリの API 設計 - GraphQL スキーマ構築ライブラリから考える #tskaigi
izumin5210
2
1k
[BalkanRuby 2026] Drop your app/services!
palkan
3
710
AIチームを指揮するOSS「TAKT」活用術 / How to Use “TAKT,” an OSS Tool for Orchestrating AI Teams
nrslib
5
710
AI時代になぜ書くのか
mutsumix
0
470
Hive Metastoreを通して学ぶIceberg REST Catalog ― 仕様から実装まで
okumin
0
290
Oxlintのカスタムルールの現況
syumai
5
750
Transactional Change Stream Processing With Debezium and Apache Flink
gunnarmorling
1
140
ビジネスモデルから紐解く、AI+型駆動開発
hirokiomote
2
3.3k
OCRを使ってゲームのアイテムをデータ化する
kishikawakatsumi
0
120
SPMマルチモジュールで テストカバレッジを取得する技法
yosshi4486
0
130
Featured
See All Featured
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
Chasing Engaging Ingredients in Design
codingconduct
0
200
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.9k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
Testing 201, or: Great Expectations
jmmastey
46
8.2k
What's in a price? How to price your products and services
michaelherold
247
13k
Leo the Paperboy
mayatellez
7
1.8k
Building an army of robots
kneath
306
46k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.7k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
We Are The Robots
honzajavorek
0
230
So, you think you're a good person
axbom
PRO
2
2k
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