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'
 })

猜你喜欢

转载自www.cnblogs.com/wuqiuxue/p/9182525.html