node---处理post请求

//nodejs  处理post请求
// 异步
const http =require('http')
const server=http.createServer((req,res)=>{
    if(req.method=='POST'){
       let postData=''
       req.on('data',chunk=>{

        postData +=chunk.tostring()
       })
       req.on('end',()=>{
           res.end('hellow world')
       })
    }
})

 

posted @ 2019-12-04 14:36  distant-遥远  阅读(583)  评论(0)    收藏  举报