Node 处理 POST 和 GET请求
创建http 服务器
请求 http 的数据包
const http = require('http')
通过http创建服务器
// req => 请求 res => 响应
const server = http.createServer( (res,req) => {
...
})
监听指定端口号
server.listen(4888,()=>{
console.log('启动成功')
})
获取请求数据函数
// 获取请求的方法 GET or POST
cons
原创
2022-03-13 18:51:24 ·
821 阅读 ·
0 评论