I am using angularjs and nodejs with MYSQL but when I get the list from the MYSQL table it is too slow to load the data about 30 seconds n load the list, what can I do to optimize this time?
Then I leave my code
var myApp = angular.module('angularTodo', ['angularUtils.directives.dirPagination']);
myApp.controller('mainController', ['$scope','$http', function($scope, $http){
$http.get('/api/todos').then(function(res) {
$scope.pacientes = res.data;
$scope.sort = function(keyname){
$scope.sortKey = keyname; //set the sortKey to the param passed
$scope.reverse = !$scope.reverse; //if true make it false and vice versa
}
}).finally(function() {
$scope.example7 += " (Finally called)";
});
}]);
NODE
app.get('/api/todos', function(req, res) {
connection.query('SELECT p1.pat_id, p1.pat_name, p1.pat_birthdate,p1.pat_sex, p1.updated_time, t1.study_desc, t1.mods_in_study, t1.study_iuid, t2.series_iuid , t3.sop_iuid FROM patient p1 INNER JOIN study t1 on p1.pk = t1.patient_fk INNER JOIN series t2 on t1.pk = t2.study_fk INNER JOIN instance t3 on t2.pk = t3.series_fk GROUP BY p1.pat_id;',function(err, data){
if(err)
{
res.send(err);
}
res.json(data);
});
I'm sorry for my English
via M. Node
No comments:
Post a Comment