Node.js——req、res对象

requset对象类型<http.IncomingMessage>,继承stream.Readable类

requset对象:

  • req.headers
  • req.rawHeaders
  • req.httpVersion
  • req.method
  • req.url

response对象:

  • res.setHeader()
  • res.end()
  • res.wtire()
  • res.statusCode
  • res.statusMessage
  • res.writeHead()  
 res.writeHead(404, 'Not Found', {
        'Content-Type': 'text/plain;charset=utf8'
 })

 

 

 

posted @ 2018-06-14 12:47  var_obj  阅读(5507)  评论(0编辑  收藏  举报