NodeJS + Express 開發筆記(一)

Express API獲取傳遞來的參數方法:

Checks route params (req.params), ex: /user/:id
Checks query string params (req.query), ex: ?id=12
Checks urlencoded body params (req.body), ex: id=
view raw gistfile1.txt hosted with ❤ by GitHub
POST的四種方法:
1. application/x-www-form-urlencoded
可以把參數放在URL內傳遞,瀏覽器原生的form表單。

在Express中,使用bodyParser.urlencoded,即可取得query的字串