text: import createError from 'http-errors';
  import express from 'express';
  import path from 'path';
  import cookieParser from 'cookie-parser';
  import logger from 'morgan';
  //se actualizan las rutas Router reemplazando por el nombre de los alias asignados en el archivo .babelrc
  import indexRouter from '@s-routes/index';
  import usersRouter from '@s-routes/users';
  
  import morgan from 'morgan';
  import winston from 'winston';
  
  const app = express();
  
  // view engine setup
  app.set('views', path.join(__dirname, 'views'));
  app.set('view engine', 'hbs');
  
  //app.use(logger('dev'));
  app.use(morgan('combined', { stream: winston.stream }));
  app.use(express.json());
  app.use(express.urlencoded({ extended: false }));
  app.use(cookieParser());
  app.use(express.static(path.join(__dirname, 'public')));
  
  app.use('/', indexRouter);
  app.use('/users', usersRouter);
  
  // catch 404 and forward to error handler
  app.use(function (req, res, next) {
    //Log
    winston.error(
      `Code: 404, Message: Page Not Found, URL: ${req.originalUrl}, Method: ${req.method}`,
    );
    next(createError(404));
  });
  
  // error handler
  app.use(function (err, req, res) {
    // set locals, only providing error in development
    res.locals.message = err.message;
    res.locals.error = req.app.get('env') === 'development' ? err : {};
  
    //Loggeando con Winston
    winston.error(
      `status: ${err.status || 500}, Message: ${err.message}, Method: ${
        req.method
      }, IP: ${req.ip}`,
    );
    // render the error page
    res.status(err.status || 500);
    res.render('error');
  });
  
  module.exports = app;
  