JavaScript NodeJS + AngularJS - after some time, I get net::ERR_CONNECTION_RESET

I'm using Express with NodeJS and AngularJS in front-end. After click here, add data there, update some record here, show a list there, I get net::ERR_CONNECTION_RESET. It's strange, after 8 or 9 navigations through the application, I got this error. Before this, the AJAX calls are doing fine.

An example of an AngularJS controller:

app.controller('GrupoController', ['$scope', '$location', '$routeParams', 'GrupoService', 
    function ($scope, $location, $routeParams, GrupoService) {

    $scope.carregarDependenciasMeusGrupos = function () {
        GrupoService.carregarDependenciasMeusGrupos().then(function (result) {
            $scope.data = {
                grupos: result.Data
            };
        });
    };

    $scope.editarGrupo = function(grupo) {
        $location.path('/editar-grupo/' + grupo.Id);
    };
}]);

And also an example of a HTTP call:

function ajax(url, async, method, params, isJson, showLoading) {
    var deferred = $q.defer();
    $http.post('http://localhost:3000' + url, params).success(function(result) {

        if (result.StatusCode === 403) {
            $location.path('/login');
        } else {
            if (result.Success) {
                deferred.resolve(result);
            } else {
                deferred.reject();
                if (result.ErrorMessage) {
                    alert(result.ErrorMessage);
                }

                if (result.RedirectTo) {
                    window.location.href = result.RedirectTo;
                }
            }
        }
    }).error(function(err) {
        deferred.reject();
    });

    return deferred.promise;
}

This is the approach I'm using with Express and NodeJS to create an action that is called through that AJAX method above:

app.post('/grupos/get-dependencies-to-grupos', app.ensureAuthentication, function(request, response, next) {
    query.openConnection().then(function(connection) {

        var gruposRepository = new repositories.Grupos(connection);
        gruposRepository.getDependenciasToGrupos(
            request.headers["authorization"], request.body.grupoId)
            .then(function(result) {
                response.json({ StatusCode: 200, Data: result });
        }, function(getDependenciesError) {
                response.json({ StatusCode: 500, ErrorMessage: getDependenciesError });
        });
   });
});

After 8 or 9 navigations, the app stopped to work suddenly. Can you guys help me? Thank you!

Answer:1

I have added [?] in right side of the form to show information about respective fields. I want to show information in small box after clicking [?]. How can i do that? Thanks in advance.

I have added [?] in right side of the form to show information about respective fields. I want to show information in small box after clicking [?]. How can i do that? Thanks in advance.

How come I can replace one escaped newline \n from a text area with anything... str1 = str1.replace(/\n /g,"7 "); but it does not work with two of them? str1 = str1.replace(/\n\n /g,"7 "); ...

How come I can replace one escaped newline \n from a text area with anything... str1 = str1.replace(/\n /g,"7 "); but it does not work with two of them? str1 = str1.replace(/\n\n /g,"7 "); ...

  1. replace escaped newline

We are using a script that allows us to to change the follow up URLS of a form dynamically so we can use the same form across multiple assets but have different follow up pages. The issue is that ...

We are using a script that allows us to to change the follow up URLS of a form dynamically so we can use the same form across multiple assets but have different follow up pages. The issue is that ...

This has been answered quite a few times before and all the responses seem to point to specificity of the CSS, but as far as I can tell, that does not seem to be the case here. HTML <button class=...

This has been answered quite a few times before and all the responses seem to point to specificity of the CSS, but as far as I can tell, that does not seem to be the case here. HTML <button class=...

  1. jquery override addclass