here I am unable to print my console code console.log("I got the data I requested");
in my node server
the error that is displayed in the browser console is in the image below
here is the code of server.js
var express = require('express');
var app = express();
app.use(express.static(__dirname + "/public"))
app.listen(3000);
console.log("server running on port 3000")
here is the code of controller.js
var app = angular.module('myApp', []);
app.controller('AppCtrl', ['$scope', '$http', function($scope, $http) {
console.log("Hello World from controller");
$http({
method: 'GET',
url: '/employeelist'
}).then(function (response) {
console.log("I got the data I requested");
$scope.employeelist = response.data;
});
employee1 = {
name: 'Sunil',
designation: 'Software Developer',
salary: '20000'
};
employee2 = {
name: 'Vamshi',
designation: 'Java Developer',
salary: '30000'
};
employee3 = {
name: 'Chethan',
designation: 'Dot Net Developer',
salary: '20000'
};
var employeelist = [employee1, employee2, employee3];
$scope.employeelist = employeelist;
}]);
I trying to print the console code in my node server
i am unable to print my console.log("") here
i have changed the server.js and controller.js codes and now if I open the localhost I can a receive a get request
here are the changes i have made
server.js
controller.js
index.html
Try catching errors
If you want to suppress the warnings globally
but it is always recommended to catch errors, not to suppress warnings