text: const express = require("express");
  require('dotenv').config();
  const mongoose = require("mongoose");
  const routes = require("./routes");
  const app = express();
  const PORT = process.env.PORT || 3001;
  
  // Define middleware here
  app.use(express.urlencoded({ extended: true }));
  app.use(express.json());
  // Serve up static assets (usually on heroku)
  if (process.env.NODE_ENV === "production") {
    app.use(express.static("client/build"));
  }
  // Add routes, both API and view
  app.use(routes);
  
  // Connect to the Mongo DB
  mongoose.connect(process.env.MONGO_URI, {
    useNewUrlParser: true,
    useUnifiedTopology: true,
  })
  .then(() => {
    console.log("MongoDB Connected...");
  })
  .catch((err) => console.log(err));
  
  // Start the API server
  app.listen(PORT, function () {
    console.log("App running on: http://localhost:" + PORT);
  });
  