text: const express = require("express");
  const logger = require("morgan");
  const mongoose = require("mongoose");
  const apiRoutes = require("./routes/api");
  const viewsRoutes = require("./routes/views");
  const db = require("./Models");
  
  const PORT = process.env.PORT || 3000;
  
  const app = express();
  
  app.use(logger("dev"));
  
  app.use(express.urlencoded({ extended: true }));
  app.use(express.json());
  
  app.use(express.static("public"));
  app.use(apiRoutes);
  app.use(viewsRoutes);
  
  mongoose.connect(process.env.MONGODB_URI || "mongodb://localhost/workout",
   { 
       useNewUrlParser: true,
        useFindAndModify: false,
        useUnifiedTopology: true,
        useCreateIndex: true,
  });
  
  
  app.listen(PORT, () => {
      console.log(`App running on port ${PORT}!`);
  });