尝试通过邮递员调用GET和POST请求:
app.get("/user", (req, res) => {
res.send("GET reqest");
});
app.post("/user", (req, res) => {
res.send("POST request");
});
对于POST请求,它工作正常,我得到“ POST请求”作为响应。但是对于GET请求,我得到了:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /user</pre>
</body>
</html>