Angularjs: load contents from local json file
<p>This is my code, I am trying to display the JSON contents, when I checked in console, the <code>data</code> which was getting returned was the whole html code, instead of json data. Where am i going wrong?</p>

<pre class="lang-html prettyprint-override"><code>&lt;html ng-app="BooksApp"&gt;

&lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;title&gt;Angular.js &lt;/title&gt;
    &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"&gt;
    &lt;script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"&gt;&lt;/script&gt;
    &lt;script&gt;
        var BooksApp = angular.module('BooksApp', []);
        BooksApp.controller("BookCtrl", ['$scope', '$http', function ($scope, $http) {
            $http.get('books.json').success(function (data) {
                $scope.books = data;
                console.log(data);
            });
    }]);
    &lt;/script&gt;
&lt;/head&gt;

&lt;body ng-controller="BookCtrl"&gt;
    &lt;h2&gt;Angular.js &lt;/h2&gt;
    &lt;table&gt;
        &lt;tr&gt;
            &lt;th&gt;Book Name&lt;/th&gt;
            &lt;th&gt;Book Price&lt;/th&gt;
        &lt;/tr&gt;
        &lt;option ng-repeat="entry in books.books" value="{{entry.name}}"&gt;{{entry.name}}&lt;/option&gt;
    &lt;/table&gt;
&lt;/body&gt;

&lt;/html&gt;
</code></pre>

<p>books.json</p>

<pre class="lang-json prettyprint-override"><code>{
    "books": [{
        "id": 2081,
        "name": "python",
        "price": "1000"
    }, {
        "id": 8029,
        "name": "c++",
        "price": "2000"
    }],
    "count": 2
}
</code></pre>

<p><a href="https://i.stack.imgur.com/6rXr6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6rXr6.png" alt="Screenshot"></a></p>

<p>app.js</p>

<pre class="lang-JS prettyprint-override"><code>var http = require('http'),
    fs = require('fs');


fs.readFile('./index.html', function (err, html) {
    if (err) {
        throw err; 
    }       
    http.createServer(function(request, response) {  
        response.writeHeader(200, {"Content-Type": "text/html"});  
        response.write(html);  
        response.end();  
    }).listen(8000);
});
</code></pre>