首页 > 解决方案 > 使用heroku进行端点调用

问题描述

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

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

当转到此链接时,它工作正常,但现在我想调用我的端点/技能,这是我在后端的 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

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

所以知道我能做什么。

标签: node.jsmongodbexpressherokuheroku-api

解决方案


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


推荐阅读