Nodejs + express post get 參數獲取小結

  1. req.params.xxxxx 從path中的變量
  2. req.query.xxxxx 從get中的?xxxx=中
  3. req.body.xxxxx 從post中的變量        

  Post下別忘了:json

app.use(bodyParser.json()); // for parsing application/json
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded

 

 

更詳細:http://blog.csdn.net/charlene0824/article/details/51199292app

相關文章
相關標籤/搜索