Good night, I have a basic program that until yesterday was good, today the afternoon began to the error in the execution of the "nodemon app" or just the "node app"
follows the error:
throw er // unhandled 'error' event error: read ECONNRESET at _errnoExecmption (util.js: 992: 11 at TCP.onread (net.js: 618: 25)
Searching all say that it is because the port is in use by another process, but I do not believe it, because the server goes up and after 2 minutes, OBS .. 2 minutes without me touching the system if I have using the system it do not stop. I even clocked it. With the nodemon it stops in a message in red saying he's waiting for a correction. I already undo the last changes that I added in the system, which was a call to a search screen through a fomulario via post (it was working well).
Does anyone know what it can be?
Below I leave my app.js (very basic)
var express = require('express');
var app = express();
var port = process.env.PORT || 3000;
var passport = require('passport');
var flash = require('connect-flash');
var path = require('path');
var morgan = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var session = require('express-session');
var expressLayouts = require('express-ejs-layouts')
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
require('./config/passport')(passport); // passo o passport para configuração
//configurar nossa aplicação express
app.use(morgan('dev')); // registrar cada pedido para o console
app.use(cookieParser()); // ler cookies (necessários para autenticação)
//app.use(bodyParser()); // obter informações de formulários html
//ver configuração do motor
app.use(express.static(path.join(__dirname, 'public')));
app.set('views', path.join(__dirname, 'app/views'));
app.set('view engine', 'ejs');
app.use(expressLayouts);
app.use(session({
secret: 'SessaoSecreta...',
resave: true,
saveUninitialized: true
}));
app.use(passport.initialize());
app.use(passport.session()); // sessões de login persistentes
app.use(flash()); // use o flash de conexão para mensagens flash armazenadas na sessão
require('./config/routes.js')(app, passport); // carregar nossas rotas e passar em nosso aplicativo e passaporte totalmente configurado
app.listen(port);
console.log(' ');
console.log('Conectado em ===> ' + port);
console.log(' ');
console.log(' ');
//pegar 404 e encaminhar para manipulador de erro
app.use(function (req, res, next) {
res.status(404).render('404', { title: "Desculpe, página nao encontrada", session: req.sessionbo });
});
app.use(function (req, res, next) {
res.status(500).render('404', { title: "Desculpe, página nao encontrada" });
});
exports = module.exports = app;
Looking for more information here, thank you !! at +