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
NTU CCSP 2012Fall - Node.js #2.1 - Simple File ...
Search
Steven Su
October 31, 2012
Programming
2
420
NTU CCSP 2012Fall - Node.js #2.1 - Simple File Host Service
node.js 0.8 + express 3
Steven Su
October 31, 2012
Tweet
Share
More Decks by Steven Su
See All by Steven Su
JSDC.TW 2013 Node.js佈署心得
xpsteven
14
1.1k
NTU CCSP 2012Fall - Mobile Web入門 回首網頁開發
xpsteven
3
270
NTU CCSP 2012Fall - Facebook
xpsteven
1
190
NTU CCSP 2012Fall - Node.js #3 - Mongoose
xpsteven
2
670
NTU CCSP 2012Fall - Node.js #2 - express.js
xpsteven
3
540
Y! Open Hack 2012 Taiwan
xpsteven
0
150
NTU CCSP 2012Fall - Node.js #2 - Advanced Javascript and Node.js
xpsteven
1
480
Other Decks in Programming
See All in Programming
Modern Angular with the NGRX Signal Store New Rules for Your Architecture @BASTA! 2024 in Mainz
manfredsteyer
PRO
0
160
僕が思い描くTypeScriptの未来を勝手に先取りする
yukukotani
9
2.4k
rbs-inlineを導入してYARDからRBSに移行する
euglena1215
1
290
Rechartsで楽にゴリゴリにカスタマイズする!
10tera
1
170
GraphQL あるいは React における自律的なデータ取得について
quramy
11
3k
ECMAScript、Web標準の型はどう管理されているか / How ECMAScript and Web standards types are maintained
petamoriken
3
390
Go1.23で入った errorsパッケージの小さなアプデ
kuro_kurorrr
2
400
エラーレスポンス設計から考える、0→1開発におけるGraphQLへの向き合い方
bicstone
5
1.5k
Kotlin 2.0が与えるAndroid開発の進化
masayukisuda
1
420
Prompt Cachingは本当に効果的なのか検証してみた.pdf
ttnyt8701
0
530
Jakarta EE meets AI
ivargrimstad
0
390
How to Break into Reading Open Source
kaspth
2
220
Featured
See All Featured
The World Runs on Bad Software
bkeepers
PRO
64
11k
The Mythical Team-Month
searls
218
43k
Rebuilding a faster, lazier Slack
samanthasiow
78
8.6k
Unsuck your backbone
ammeep
667
57k
Git: the NoSQL Database
bkeepers
PRO
425
64k
Building Flexible Design Systems
yeseniaperezcruz
325
38k
Music & Morning Musume
bryan
46
6k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Statistics for Hackers
jakevdp
794
220k
RailsConf 2023
tenderlove
28
810
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2k
Faster Mobile Websites
deanohume
304
30k
Transcript
簡易檔案上傳網站
目標 • 可以上傳檔案並給名稱 • 可以清單顯示已經上傳的檔案 • 可以顯示已經上傳的檔案
環境 • 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: 測試看看