Skip to the content.

1. 開始安裝設定 node.js 寫程式的環境

2. 寫個簡單的 node 程式.

3. 弄個 Web Server 試試看

4. npm 裝 express Web Framework 寫一個 index.js

因爲常常要 control - C 重啓 node index.js
安裝使用 nodemon 可以自動偵測檔案變化, 重load, 開發上比較方便. (Mac 上可能要 $ sudo npn i -g nodeman )

$ npm install -g nodemon
$ nodemon index.js

6. 測試 get 透過 URL 傳 Param 給 Server

7. 測試 post 透過 BODY 傳 JSON 給 Server

8. 設定靜態的檔案 html, css, js, JPG 等

app.use(express.static('public'))