nodejs简单例子
nodejs 生态 2023 https://www.51cto.com/article/762446.html
post
const http = require('http') const server = http.createServer((req,res)=>{ if(req.method === 'POST'){ //数据格式 console.log('content-type',req.headers['content-type']) //接受数据 let postData = "" req.on('data',chunk=>{ postData += chunk.toString() }) req.on('end',()=>{ console.log(postData,'2121') res.end('hello world') }) } }) server.listen(8000); console.log('ok')