-1

I have some text in the form of some JSON that I have been able to pull from Steam's Web API using my server written in ExpressJS/nodeJS. This JSON is stored in a variable.

What I am trying to do here is to basically take the JSON that I have stored in a variable, send it to my Angular and then display the data onto my page.

When I do, my console shows the raw HTML of the page.

Is there something that I am missing?

My node:

app.get('/steam.html', function(req, res){
  request.get(steam_api, function(error, steamResponse, steamBody) {

    var steamList = JSON.parse(steamBody);
    gameList = steamList["applist"]["apps"]; 

    res.json({gl: gameList});  

  });
});

My angular:

$http.get('steam.html').success(function(data){
    $scope.gameList = data;
    console.log(data);
  });

My steam.html

<body ng-app="gameSearch" ng-controller="gameSearchController">
    <p>{{title}}</p>
    <ul ng-repeat="steam in gameList track by $index">
        <li>{{steam.name}}</li>
    </ul>
</body>

Edit: If it helps here's a screenshot of what I am seeing. As you will see I am getting a bunch of bullet points back but not the names of each game.

Express JS passes bullet points

Edit 2: Another thing I should add for clarity is that I used some nodeJS code that I found on a blogpost from codepen as shown below (https://codepen.io/johnchristopherjones/post/how-do-i-use-the-steam-api-in-my-web-app):

app.get('/steam/game/:appid/achievements', function(httpRequest, httpResponse) {
    // Calculate the Steam API URL we want to use
    var url = 'http://api.steampowered.com/ISteamUserStats/GetSchemaForGame/' +
        'v2/?key=YOURSTEAMAPIKEYHERE&appid=' +
        httpRequest.params.appid;
    request.get(url, function(error, steamHttpResponse, steamHttpBody) {
        httpResponse.setHeader('Content-Type', 'application/json');
        httpResponse.send(steamHttpBody);
    });
});
Adi Khajuria
  • 11
  • 1
  • 3
  • Can You provide https://jsfiddle.net/ for your code snippet please. – G SubbaRao Dec 04 '16 at 14:07
  • Here you go: https://jsfiddle.net/ujo8k80e/ I should mention that steam_api as shown in my node is a link to a Steam API call which includes my Steam web API Key (which I cannot give out per the steam web API terms. – Adi Khajuria Dec 04 '16 at 15:04
  • Update: In my HTML, I changed the contents of the li tag to just `
  • {{steam}}
  • ` then each bullet point shows each character of my HTML. As such $scope.gameList is somehow picking up the raw HTML of steam.html instead of my JSON(stored in a variable in my NodeJS/expressJS server). Here's the imgur screenshot: http://i.imgur.com/jbnJMYQ.jpg – Adi Khajuria Dec 05 '16 at 17:29