text: require("dotenv").config();
  
  var express = require("express");
  var exphbs = require("express-handlebars");
  var db = require("./models");
  var session = require("express-session");
  var app = express();
  var morgan = require("morgan");
  var PORT = process.env.PORT || 3000;
  
  // Middleware
  app.use(morgan());
  app.use(express.urlencoded({ extended: false }));
  app.use(express.json());
  app.use(express.static("public"));
  app.use(
    session({
      secret: "Noctis Lucis Caelum"
    })
  );
  
  // Handlebars
  app.engine(
    "handlebars",
    exphbs({
      defaultLayout: "main"
    })
  );
  app.set("view engine", "handlebars");
  app.set("trust proxy", 1);
  // Routes
  require("./routes/userApiRoutes")(app);
  require("./routes/apiRoutes")(app);
  require("./routes/htmlRoutes")(app);
  
  var syncOptions = { force: false };
  
  // If running a test, set syncOptions.force to true
  // clearing the `testdb`
  if (process.env.NODE_ENV === "test") {
    syncOptions.force = true;
  }
  
  // Starting the server, syncing our models ------------------------------------/
  db.sequelize.sync(syncOptions).then(function() {
    app.listen(PORT, function() {
      console.log(
        "==> 🌎  Listening on port %s. Visit http://localhost:%s/ in your browser.",
        PORT,
        PORT
      );
    });
  });
  
  module.exports = app;
  