为什么POST在Firebase部署上起作用但在Firebase上不能起作用?

时间:2018-07-20 18:04:23

标签: html node.js firebase http post

当有人上传文件时,我正在尝试发送一条消息。当我将应用程序部署到Web上时,此方法工作正常,但是在本地运行时,出现错误。 Link for error on HTTP Post

调试日志未显示任何错误,并且终端显示“用户功能已成功执行”。

这是函数文件夹中app.js文件中的发布路线。

    app.post('/upload', function(req, res) {
         res.send('File has been uploaded');
}); 

这是位于views文件夹中的home.hbs文件中的HTML代码片段(正确显示)。

    <form action="/upload" method="post" encType="multipart/form-data">        
      Input your itinerary (.xls,.xlsx): <input id="spreadsheet" name="spreadsheet" type="file" accept="application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">
      Username: <input id = "username" type="text">

      <p><input id="submit" type="submit" value="Submit"></p>

  </form>

让我感到困惑的是,我的app.get路由可以很好地呈现我的主页。无法在本地运行我的代码是调试的一大难题,因为部署时console.log语句不起作用。在这个问题上的任何帮助将不胜感激。

0 个答案:

没有答案