Parse body from GET request using nodejs, express, body-parser?

前端 未结 1 1612
感情败类
感情败类 2021-01-14 18:17

Is it possible to retrieve the body contents using express?

I started by trying body-parser but that doesn\'t seem to work wit

相关标签:
1条回答
  • 2021-01-14 18:51

    GET requests don't have a body, they have query strings. In order to access a query string in expressJS you should use the req.query object.

    res.end(JSON.stringify(req.query, null, 2));
    
    0 讨论(0)
提交回复
热议问题