【问题标题】:Endpoint call using heroku使用heroku进行端点调用
【发布时间】:2020-11-27 17:05:57
【问题描述】:

我已经在heroku上部署了我的后端,

https://morning-tor-91556.herokuapp.com/

当转到此链接时,它工作正常,但现在我想调用我的端点 /skills,这是我在后端的 nodeJS 中制作的,代码是

app.get("/skills",function(req,res){
    Skill.find(function(err,foundSkills){
      if(!err){
        res.send(foundSkills);
        console.log(foundSkills);
      }else{
        res.send(err);
      }
    });
  });

https://morning-tor-91556.herokuapp.com/skills

但是当我转到此链接时,它只是加载而不是我应该从 get 请求中获得的响应,但是如果我转到 localhost:9000/skills,我会根据需要获得我的收藏。

所以知道我能做什么。

【问题讨论】:

    标签: node.js mongodb express heroku heroku-api


    【解决方案1】:

    错误可能在数据库配置中,您应该分享有关它的完整代码。

    猜你喜欢
    • 2012-07-10
    • 2021-12-01
    • 2021-12-09
    • 2019-09-26
    • 1970-01-01
    • 2017-11-30
    • 1970-01-01
    • 2021-05-15
    • 1970-01-01
    相关资源
    最近更新 更多