无法获取 POST 路线

Cannot Get POST Route

我正在做一个项目,但无法找到我在以下代码中制造的错误。

我在以下代码中没有发现任何问题 (imo),但不知何故它不是 posting 请求。

我无法接收此路由上的 post 个请求:

错误:不能POST/campgrounds/5c023e5f1452761b2b937e91/maketreasurer

router.post("/:id/adminpanel/maketreasurer",function(req,res){
    res.send("posted");
    });

我从这个页面发送我的请求:

   <% include ../partials/header %>

//show all faculty heads
//select faculty header
//assign faculty head

<h3>Users</h3>
<table id="t01">
            <tr>
              <th>firstname</th>
              <th>----</th>
              <th>Username</th>
              <th>----</th>
              <th>Faculty Number</th>
              <th>----</th>
              <th>Student Number</th>
              <th></th>
            </tr>

<% parm.users.forEach(function(users){ %>
          <tr>
            <td><%= users.firstname %></td>
            <td></td>
            <td><%= users.username%></td>
            <td></td>
            <td><%= users.facultynumber%></td>
            <td></td>
            <td><%= users.studentnumber%></td>          
          </tr>
        <% }); %>
        </table>
        </form>

        Make A Treasurer
        <form action="/campgrounds/<%=parm.id%>/maketreasurer" 
        method="POST">
          <button>Submit</button>
        </form>

错误很明显,

Cannot POST `/campgrounds/5c023e5f1452761b2b937e91/maketreasurer`
where id = 5c023e5f1452761b2b937e91

现在,您的路线是 /:id/adminpanel/maketreasurer,考虑 /campgrounds 作为基础 url,adminpanel 在哪里? post 请求应该是:

/campgrounds/5c023e5f1452761b2b937e91/adminpanel/maketreasurer