text: "use strict";
  
  const Hapi = require("@hapi/hapi");
  const dotenv = require("dotenv");
  const laabr = require("laabr");
  const Routes = require("./routes");
  // const connectDB = require("./config/db_mongo");
  // const connectDB = require("./app/config/db_mysql");
  // const db = require("./app/config/db.sequelize");
  
  // Load configuration
  dotenv.config({ path: "./app/config/config.env" });
  const PORT = process.env.PORT || 5050;
  const HOST = process.env.SERVER_HOST || "0.0.0.0";
  
  const server = Hapi.server({
    port: PORT,
    host: HOST,
  });
  
  // Add routes
  server.route(Routes);
  
  // await Models.sequelize.sync();
  
  const init = async () => {
    try {
      // Loggin
      if (process.env.NODE_ENV === "development") {
        const options = {
          formats: { onPostStart: ":time :start :level :message" },
          tokens: { start: () => "[start]" },
          indent: 2,
        };
        await server.register({
          plugin: laabr,
          options,
          // options: {},
        });
      }
  
      // Starting server
      await server.start();
  
      //
      console.log(
        `🚀 Server running in ${process.env.NODE_ENV} mode on port ${PORT} .:: ${server.info.uri} ::. Main:(${__filename})`
      );
  
      //
    } catch (err) {
      console.error(err);
    }
  };
  
  process.on("unhandledRejection", (err) => {
    console.log(err);
    process.exit(1);
  });
  
  init();
  