form.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" cnotallow="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <form actinotallow="http://localhost:8887/aaa" method="POST"> 用户名:<input type="text" name="username"> 密码:<input type="password" name="password"> <input type="submit" value="提交"> </form> </body> </html>demo7.js let http = require('http') //let url = require('url'); let querystring = require('querystring'); http.createServer((req,res)=>{ let result=[]; req.on('data',buffer=>{ result.push(buffer); }) req.on('end',()=>{ //console.log(result); let data=Buffer.concat(result).toString(); //console.log(data.toString()); console.log(querystring.parse(data)); }) }).listen(8887)