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 #4 middleware fo...
Search
gfnork
June 20, 2014
Programming
0
510
gfnork node.js workshop Lesson #4 middleware for node
connect.js, express.js and other fun things
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
950
gfnork node.js workshop Lesson #2 JavaScript Async
freundschaft
0
950
gfnork node.js workshop Lesson #3 node.js basics
freundschaft
0
460
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
CSC305 Lecture 06
javiergs
PRO
0
250
TFLintカスタムプラグインで始める Terraformコード品質管理
bells17
2
210
釣り地図SNSにおける有料機能の実装
nokonoko1203
0
150
XP, Testing and ninja testing ZOZ5
m_seki
3
730
Foundation Modelsを実装日本語学習アプリを作ってみた!
hypebeans
0
120
タスクの特性や不確実性に応じた最適な作業スタイルの選択(ペアプロ・モブプロ・ソロプロ)と実践 / Optimal Work Style Selection: Pair, Mob, or Solo Programming.
honyanya
3
180
技術的負債の正体を知って向き合う
irof
0
190
スマホから Youtube Shortsを見られないようにする
lemolatoon
27
33k
Goで実践するドメイン駆動開発 AIと歩み始めた新規プロダクト開発の現在地
imkaoru
4
860
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
450
開発生産性を上げるための生成AI活用術
starfish719
3
1.3k
Go言語の特性を活かした公式MCP SDKの設計
hond0413
1
240
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
79
6k
GraphQLとの向き合い方2022年版
quramy
49
14k
The Cost Of JavaScript in 2023
addyosmani
55
9k
How STYLIGHT went responsive
nonsquared
100
5.8k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Git: the NoSQL Database
bkeepers
PRO
431
66k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
253
22k
A better future with KSS
kneath
239
18k
Into the Great Unknown - MozCon
thekraken
40
2.1k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
15k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.2k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
10
600
Transcript
None
2
3
4 var app = connect() .use(connect.logger('dev')) .use(connect.static('public')) .use(function (req, res)
{ res.end('hello world\n'); }) http.createServer(app).listen(3000);
5 function SampleMiddleware(req, res, next) { next(); }
6
7
8 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/');
9 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/'); var express = require('express'); var app = express(); app.get('/', function (req, res) { res.send('hello world'); }); app.listen(3000);
10 e.g. http://examplewebsite/customers/showall http://examplewebsite/customers/add http://examplewebsite/customers/delete
11
12 https://github.com/visionmedia/consolidate.js app.engine('jade', require('jade').__express); app.set('view engine', 'jade');
13 res.render('email', { name: 'Tobi' }, function (err, html) {
// ... });
14
15
16
17