Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
470
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
510
gfnork node.js workshop Lesson #1 JavaScript Basics
freundschaft
0
960
gfnork node.js workshop Lesson #2 JavaScript Async
freundschaft
0
960
gfnork node.js workshop Lesson #4 middleware for node
freundschaft
0
510
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
脳の「省エネモード」をデバッグする ~System 1(直感)と System 2(論理)の切り替え~
panda728
PRO
0
100
手が足りない!兼業データエンジニアに必要だったアーキテクチャと立ち回り
zinkosuke
0
750
C-Shared Buildで突破するAI Agent バックテストの壁
po3rin
0
390
Integrating WordPress and Symfony
alexandresalome
0
160
Cell-Based Architecture
larchanjo
0
130
ViewファーストなRailsアプリ開発のたのしさ
sugiwe
0
500
dotfiles 式年遷宮 令和最新版
masawada
1
790
TestingOsaka6_Ozono
o3
0
170
SwiftUIで本格音ゲー実装してみた
hypebeans
0
420
生成AIを利用するだけでなく、投資できる組織へ
pospome
2
350
Rediscover the Console - SymfonyCon Amsterdam 2025
chalasr
2
170
Developing static sites with Ruby
okuramasafumi
0
310
Featured
See All Featured
Writing Fast Ruby
sferik
630
62k
Done Done
chrislema
186
16k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Designing for humans not robots
tammielis
254
26k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
710
How to train your dragon (web standard)
notwaldorf
97
6.4k
Context Engineering - Making Every Token Count
addyosmani
9
530
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.3k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.8k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.6k
Faster Mobile Websites
deanohume
310
31k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.8k
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