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
540
Building the GitHub workspace app
bkeepers
PRO
1
440
Contributing to Your Career
bkeepers
PRO
4
780
A Maturity Model for Embracing Open Source Software
bkeepers
PRO
3
970
Open Source Principles for Internal Engineering Teams
bkeepers
PRO
8
1.4k
Carbon, Automobiles, Bebop & Fashion
bkeepers
PRO
1
600
Tending Your Open Source Garden, v2
bkeepers
PRO
1
670
Tending Your Open Source Garden
bkeepers
PRO
2
1k
The Loyal Renegade
bkeepers
PRO
3
990
Other Decks in Programming
See All in Programming
Denoのセキュリティに関する仕組みの紹介 (toranoana.deno #23)
uki00a
0
220
コマンドとリード間の連携に対する脅威分析フレームワーク
pandayumi
1
210
Deno Tunnel を使ってみた話
kamekyame
0
320
AIエージェント、”どう作るか”で差は出るか? / AI Agents: Does the "How" Make a Difference?
rkaga
2
920
疑似コードによるプロンプト記述、どのくらい正確に実行される?
kokuyouwind
0
160
組み合わせ爆発にのまれない - 責務分割 x テスト
halhorn
1
180
Pythonではじめるオープンデータ分析〜書籍の紹介と書籍で紹介しきれなかった事例の紹介〜
welliving
3
780
LLMで複雑な検索条件アセットから脱却する!! 生成的検索インタフェースの設計論
po3rin
4
1.1k
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
150
AI時代を生き抜く 新卒エンジニアの生きる道
coconala_engineer
1
520
愛される翻訳の秘訣
kishikawakatsumi
3
370
フロントエンド開発の勘所 -複数事業を経験して見えた判断軸の違い-
heimusu
6
2.4k
Featured
See All Featured
The Mindset for Success: Future Career Progression
greggifford
PRO
0
210
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Reality Check: Gamification 10 Years Later
codingconduct
0
2k
Heart Work Chapter 1 - Part 1
lfama
PRO
4
35k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.9k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
130
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
250
GraphQLの誤解/rethinking-graphql
sonatard
74
11k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
140
Exploring anti-patterns in Rails
aemeredith
2
220
Measuring & Analyzing Core Web Vitals
bluesmoon
9
730
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
180
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