text: const express = require('express')
  const session = require('express-session')
  const FileStore = require('session-file-store')(session)
  const nunjucks = require('nunjucks')
  const path = require('path')
  const flash = require('connect-flash')
  
  class App {
      constructor() {
          this.express = express()
          this.isDev = process.env.NODE_ENV !== 'production'
  
          this.middlewares()
          this.views()
          this.routes()
      }
  
      middlewares() {
          this.express.use(express.urlencoded({ extended: false }))
          this.express.use(flash())
          this.express.use(
              session({
                  name: 'root',
                  secret: 'FSRezende.com.br',
                  resave: true,
                  store: new FileStore({
                      path: path.resolve(__dirname, 'sessions')
                  }),
                  saveUninitialized: true
              }))
  
      }
  
      views() {
          nunjucks.configure(path.resolve(__dirname, 'app', 'views'),
              {
                  watch: this.isDev,
                  express: this.express,
                  autoescape: true
              })
  
          this.express.use(express.static(path.resolve(__dirname, 'public')))
          this.express.use(express.static(path.resolve(__dirname, 'public', 'js')))
          this.express.use(express.static(path.resolve(__dirname, 'public', 'css')))
  
          this.express.set('view engine', 'njk')
  
      }
  
      routes() {
          this.express.use(require('./routes'))
      }
  }
  
  module.exports = new App().express