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
940
gfnork node.js workshop Lesson #2 JavaScript Async
freundschaft
0
940
gfnork node.js workshop Lesson #4 middleware for node
freundschaft
0
500
gfnork node.js workshop Lesson #5 node.js databases
freundschaft
0
470
gfnork node.js workshop Lesson #6 Unit testing
freundschaft
0
460
Other Decks in Programming
See All in Programming
速いWebフレームワークを作る
yusukebe
5
1.7k
請來的 AI Agent 同事們在寫程式時,怎麼用 pytest 去除各種幻想與盲點
keitheis
0
120
Amazon RDS 向けに提供されている MCP Server と仕組みを調べてみた/jawsug-okayama-2025-aurora-mcp
takahashiikki
1
110
為你自己學 Python - 冷知識篇
eddie
1
350
概念モデル→論理モデルで気をつけていること
sunnyone
2
260
AI時代のUIはどこへ行く?
yusukebe
18
8.9k
AI Coding Agentのセキュリティリスク:PRの自己承認とメルカリの対策
s3h
0
230
ユーザーも開発者も悩ませない TV アプリ開発 ~Compose の内部実装から学ぶフォーカス制御~
taked137
0
180
今から始めるClaude Code入門〜AIコーディングエージェントの歴史と導入〜
nokomoro3
0
180
プロパティベーステストによるUIテスト: LLMによるプロパティ定義生成でエッジケースを捉える
tetta_pdnt
0
1.7k
はじめてのMaterial3 Expressive
ym223
2
750
1から理解するWeb Push
dora1998
7
1.9k
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
Producing Creativity
orderedlist
PRO
347
40k
Music & Morning Musume
bryan
46
6.8k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
840
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
188
55k
Code Reviewing Like a Champion
maltzj
525
40k
Imperfection Machines: The Place of Print at Facebook
scottboms
268
13k
Statistics for Hackers
jakevdp
799
220k
Faster Mobile Websites
deanohume
309
31k
jQuery: Nuts, Bolts and Bling
dougneiner
64
7.9k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
36
2.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