Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
NTU CCSP 2012Fall - Node.js #2.1 - Simple File ...
Search
Steven Su
October 31, 2012
Programming
470
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
NTU CCSP 2012Fall - Node.js #2.1 - Simple File Host Service
node.js 0.8 + express 3
Steven Su
October 31, 2012
Transcript
18 slides
簡易檔案上傳網站
目標 • 可以上傳檔案並給名稱 • 可以清單顯示已經上傳的檔案 • 可以顯示已經上傳的檔案
環境 • Windows 7 • Sublime Text 2 • Node.js
0.8.x • Express.js 3.0
要求 • 安裝好node 0.8.x • 可以使用npm指令 • 可以使用node指令
Step 0: 安裝express 打開終端機 輸入 npm install express –g -g也可以放install前面
-g代表安裝到global 才可以在任何資料夾當作指 令來使用 簡單說就是安裝程式到系統
Step 0: 安裝express
Step 1: 建立專案 測試express指令
Step 1: 建立專案 express -e -c less -s uploadserver
Step 2: 安裝所需要的庫 npm install 會自動依照目錄下 的package.json安裝所依賴的 套件到目前目錄(local mode)
Step 3: 驗證安裝 node app.js 打開瀏覽器 http://localhost:3000/
Step 4: 打開ST2 以資料夾模式開啟
Step 5: 編輯bodyParser 修改bodyParser keepExtensions => 保留附檔名 uploadDir => 指定上傳到哪個資料夾
Step 6: 接受上傳 var database 模擬一個資料庫 res.redirect(路徑) 回傳302導向其他 網頁
Step 7: 修改index view
Step 8: 測試看看吧
Step 9: 修改index的handler
Step 10: 再修改index.ejs
Step 11: 測試看看
More Decks by Steven Su
See All by Steven Su
JSDC.TW 2013 Node.js佈署心得
xpsteven
14
1.3k
NTU CCSP 2012Fall - Mobile Web入門 回首網頁開發
xpsteven
3
400
NTU CCSP 2012Fall - Facebook
xpsteven
1
230
NTU CCSP 2012Fall - Node.js #3 - Mongoose
xpsteven
2
790
NTU CCSP 2012Fall - Node.js #2 - express.js
xpsteven
3
600
Y! Open Hack 2012 Taiwan
xpsteven
0
290
NTU CCSP 2012Fall - Node.js #2 - Advanced Javascript and Node.js
xpsteven
1
580
Other Decks in Programming
See All in Programming
マルチプロダクトSaaSの アプリ一覧を速くする——複数プロダクトにまたがる「権限行脚」を減らすまで #techramen26conf
mktakuya
1
260
特急いなほ as a Workflow / 20261107jaws-festa-2026-akita-lt
kasacchiful
PRO
0
110
Distance field of Julia set
kinakomoti321
0
330
AIコーディングをセッションで終わらせない: PHPライブラリ開発におけるコンテキスト承継設計
ickx
0
110
SONY CISC-NEWS NWS-1750 + NWB-225 ハードウェアメンテとフレームバッファカラー対応 / KOF2026
tsutsui
0
150
あなたはMCPの機能を、まだ知らない。
4geru
1
750
Stage 3でも仕様は変わる。アプリケーション開発者のためのTC39プロセスの読み方
bicstone
1
1.2k
ローカルLLMの基本と近況 2611 / Local LLM basics and recent situation 2611
kishida
3
680
Growing PicoRuby's Ecosystem on ESP32
yuuu
2
150
RaspberryPi 5で軽くはじめるk3sとtailscaleを用いたホームサーバー構築 (1)
nasum
0
450
Canvas 2D Context Next
petamoriken
0
860
読みやすい!と評判(?)の発表の準備にかける私のこだわり
shoheimitani
0
170
Featured
See All Featured
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
510
How to make the Groovebox
asonas
2
2.6k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
320
Odyssey Design
rkendrick25
PRO
3
980
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3.1k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
640
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.6k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
330
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
500
How to Talk to Developers About Accessibility
jct
2
630