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
360
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
590
Tending Your Open Source Garden
bkeepers
PRO
2
970
The Loyal Renegade
bkeepers
PRO
3
870
Other Decks in Programming
See All in Programming
Embracing Ruby magic
vinistock
2
260
Optimizing JRuby 10
headius
0
610
20250426 GDGoC 合同新歓 - GDGoC のススメ
getty708
0
110
KANNA Android の技術的課題と取り組み
watabee
1
540
The New Developer Workflow: How AI Transforms Ideas into Code
danielsogl
0
140
UMAPをざっくりと理解 / Overview of UMAP
kaityo256
PRO
3
1.6k
AIコーディングの理想と現実
tomohisa
37
40k
The Nature of Complexity in John Ousterhout’s Philosophy of Software Design
philipschwarz
PRO
0
170
Global Azure 2025 @ Kansai / Hyperlight
kosmosebi
0
150
Beyond_the_Prompt__Evaluating__Testing__and_Securing_LLM_Applications.pdf
meteatamel
0
110
カウシェで Four Keys の改善を試みた理由
ike002jp
1
140
Boost Your Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
920
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
105
19k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
52
2.5k
Designing for Performance
lara
608
69k
Why You Should Never Use an ORM
jnunemaker
PRO
56
9.4k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.6k
Build The Right Thing And Hit Your Dates
maggiecrowley
35
2.7k
Writing Fast Ruby
sferik
628
61k
GraphQLとの向き合い方2022年版
quramy
46
14k
Testing 201, or: Great Expectations
jmmastey
42
7.5k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.7k
YesSQL, Process and Tooling at Scale
rocio
172
14k
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