const http = require('http');
const app = http.createServer()
app.on('request', (req, res) => {
if(req.method === 'GET') {
res.end('<h1>gett</h1>')
} else if(req.method === 'POST') {
res.end(`<h1>postt</h1>`)
}
console.log(req.method);
// res.end('<h1>Hi,ueser</h1>')
})
app.listen(3333)
console.log('哈哈');
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<!--
method: 指定当前表单提交的方式
action: 指定当前表单提交的地址
-->
<form method="post" action="http://localhost:3000">
<input type="text" name="username">
<input type="password" name="password">
<input type="submit">
</form>
</body>
</html>