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
gfnork node.js workshop Lesson #3 node.js basics
Search
gfnork
June 20, 2014
Programming
0
460
gfnork node.js workshop Lesson #3 node.js basics
first steps, modules, npm, Events
gfnork
June 20, 2014
Tweet
Share
More Decks by gfnork
See All by gfnork
Basic Mobile Application Design
freundschaft
0
500
gfnork node.js workshop Lesson #1 JavaScript Basics
freundschaft
0
930
gfnork node.js workshop Lesson #2 JavaScript Async
freundschaft
0
930
gfnork node.js workshop Lesson #4 middleware for node
freundschaft
0
490
gfnork node.js workshop Lesson #5 node.js databases
freundschaft
0
460
gfnork node.js workshop Lesson #6 Unit testing
freundschaft
0
450
Other Decks in Programming
See All in Programming
アンドパッドの Go 勉強会「 gopher 会」とその内容の紹介
andpad
0
280
ニーリーにおけるプロダクトエンジニア
nealle
0
700
20250704_教育事業におけるアジャイルなデータ基盤構築
hanon52_
3
200
RailsGirls IZUMO スポンサーLT
16bitidol
0
120
エンジニア向け採用ピッチ資料
inusan
0
180
Hypervel - A Coroutine Framework for Laravel Artisans
albertcht
1
110
なんとなくわかった気になるブロックテーマ入門/contents.nagoya 2025 6.28
chiilog
1
250
童醫院敏捷轉型的實踐經驗
cclai999
0
210
LT 2025-06-30: プロダクトエンジニアの役割
yamamotok
0
650
High-Level Programming Languages in AI Era -Human Thought and Mind-
hayat01sh1da
PRO
0
650
AIコーディング道場勉強会#2 君(エンジニア)たちはどう生きるか
misakiotb
1
270
既存デザインを変更せずにタップ領域を広げる方法
tahia910
1
260
Featured
See All Featured
Code Reviewing Like a Champion
maltzj
524
40k
Typedesign – Prime Four
hannesfritz
42
2.7k
How to train your dragon (web standard)
notwaldorf
94
6.1k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
181
53k
How STYLIGHT went responsive
nonsquared
100
5.6k
Raft: Consensus for Rubyists
vanstee
140
7k
GitHub's CSS Performance
jonrohan
1031
460k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
46
9.6k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.5k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
940
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.5k
Transcript
None
2
3
4
5
6
7
8 node > console.log('Hello World'); Hello World
9 console.log('Hello World'); >node app.js Hello World
10 var http = require('http'); http.createServer(function (req, res) { res.writeHead(200,
{ 'Content-Type': 'text/plain' }); res.end('Hello World\n'); }).listen(1337, '127.0.0.1'); console.log('Server running at http://127.0.0.1:1337/');
11 var http = require('http'); http.createServer(function (req, res) { res.writeHead(200,
{ 'Content-Type': 'text/plain' }); res.end('Hello World\n'); }).listen(1337, '127.0.0.1'); console.log('Server running at http://127.0.0.1:1337/');
12
13 exports.helloworld = function () { console.log('Hello World'); } var
test = require('./test.js'); test.helloworld();
14 module.exports = function () { this.name = "test object";
this.color = "red"; this.size = "large"; } var test = require('./test.js'); var testObject = new test(); console.log('name:' + testObject.name); console.log('color:' + testObject.color); console.log('size:' + testObject.size);
15
16
17 { "name": "TestNodejsApp", "version": "0.0.0", "description": "TestNodejsApp", "private": true,
"main": "app.js", "author": { "name": "Qiong Wu", "email": "" }, "dependencies": { "express": "3.4.4", "jade": "*", "stylus": "*" } }
18
19
20 server.on('connection', function (stream) { console.log('someone connected!'); }); server.once('connection', function
(stream) { console.log('Ah, we have our first user!'); });
21 function Test(colour) { this.colour = colour; events.EventEmitter.call(this); this.sendEvent =
function() { this.emit('EventSent'); } } Test.prototype.__proto__ = events.EventEmitter.prototype; var testObject = new Test('white'); testObject.on('EventSent', function() { console.log('Event received'); }); testObject.sendEvent();
22
23 // write 'hello, ' and then end with 'world!'
http.createServer(function (req, res) { res.write('hello, '); res.end('world!'); // writing more now is not allowed! });
24