端口路线在我的Express JS Project

问题描述 投票:0回答:1
INDEX.EJS代码块如下:

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Travel Tracker</title> <link rel="stylesheet" href="./styles/main.css"> </head> <body> <form action="/add" method="post"> <input type="text" name="country" autofocus placeholder="<%= locals.error ? error : 'Enter country name'%>"> <button type="submit">Add</button> </form> <h2 class="total-count">Total Countries: <%=total%> </h2> <script> const country_codes = "<%= countries %>".split(",") console.log(typeof ("<%= countries %>")) country_codes.forEach(code => { document.getElementById(code).style.fill = 'teal' }); </script> </body> </html>
当我试图到达http:// localhost:3000/添加路由时。获取此错误

将URL分为浏览器的地址栏将发出GET请求,而不是发布请求。 when Trying to reach the /add route getting this error.您可以使用其他一些工具发布发布请求 - 例如,Curl

node.js postgresql express web-development-server
1个回答
0
投票

curl http://localhost:3000/add -d "country=narinia"

© www.soinside.com 2019 - 2025. All rights reserved.