【问题标题】:node.js & EJS : in the APP.JS app.get doesn't worknode.js & EJS:在 APP.JS app.get 中不起作用
【发布时间】:2018-08-11 09:51:57
【问题描述】:

我使用 Webstorm。我用“get”方法在第6页准备了一个表格。但是 app.get 不起作用。没有任何错误。似乎 APP.JS 忽略了。

在 PAGE6.EJS 中

<form action="/page6" method="get" >
     <input type="email" class="form-control" id="to">
     <button type="submit" class="btn btn-success">Send</button>
</form>

在 APP.JS 中

app.get("/page6",(res,req)=>{
  console.log("Ok.Done.");
});

【问题讨论】:

  • 我缩短了代码。删除了不必要的行。
  • 对不起。我正在为我的问题添加解释。我的错。该评论是针对我的问题...
  • 对不起,Stack Overflow 不知何故将此评论显示为对我的回复。如果您想在帖子中添加信息,请edit it!
  • 好的。谢谢你。没有任何错误。似乎 APP.JS 忽略了。我不明白为什么。
  • "似乎 APP.JS 忽略了" — 你期望发生的事情没有发生?您在寻找console.log 的输出吗?在哪里?

标签: javascript node.js get webstorm ejs


【解决方案1】:

在 PAGE6.JS 中

 router.get ('/page6",(res,req)=>{
      console.log("Ok.Done.");
 });

我认为get方法是由路由器页面的JS处理的,而不是APP.JS。它可能与 webstorm 属性有关。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-05-01
    • 1970-01-01
    • 2019-02-07
    • 2017-08-12
    • 2015-12-17
    • 2022-06-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多