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
440
Building the GitHub workspace app
bkeepers
PRO
1
330
Contributing to Your Career
bkeepers
PRO
3
690
A Maturity Model for Embracing Open Source Software
bkeepers
PRO
3
890
Open Source Principles for Internal Engineering Teams
bkeepers
PRO
7
1.3k
Carbon, Automobiles, Bebop & Fashion
bkeepers
PRO
1
490
Tending Your Open Source Garden, v2
bkeepers
PRO
1
550
Tending Your Open Source Garden
bkeepers
PRO
2
940
The Loyal Renegade
bkeepers
PRO
3
820
Other Decks in Programming
See All in Programming
DROBEの生成AI活用事例 with AWS
ippey
0
130
さいきょうのレイヤードアーキテクチャについて考えてみた
yahiru
3
750
Amazon Q Developer Proで効率化するAPI開発入門
seike460
PRO
0
110
データベースのオペレーターであるCloudNativePGがStatefulSetを使わない理由に迫る
nnaka2992
0
140
Amazon Bedrock Multi Agentsを試してきた
tm2
1
280
Writing documentation can be fun with plugin system
okuramasafumi
0
120
富山発の個人開発サービスで日本中の学校の業務を改善した話
krpk1900
4
380
pylint custom ruleで始めるレビュー自動化
shogoujiie
0
120
GitHub Actions × RAGでコードレビューの検証の結果
sho_000
0
260
第3回関東Kaggler会_AtCoderはKaggleの役に立つ
chettub
3
1k
How mixi2 Uses TiDB for SNS Scalability and Performance
kanmo
36
14k
ファインディの テックブログ爆誕までの軌跡
starfish719
2
1.1k
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
98
5.4k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
1k
Designing Experiences People Love
moore
140
23k
Build The Right Thing And Hit Your Dates
maggiecrowley
34
2.5k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Measuring & Analyzing Core Web Vitals
bluesmoon
6
240
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
46
2.3k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.1k
Navigating Team Friction
lara
183
15k
Facilitating Awesome Meetings
lara
52
6.2k
GraphQLとの向き合い方2022年版
quramy
44
13k
Documentation Writing (for coders)
carmenintech
67
4.6k
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