text: const express = require("express");
  const mongoose = require("mongoose");
  const routes = require("./routes");
  // ! see line 22
  // const path = require("path");
  const PORT = process.env.PORT || 3001;
  const app = express();
  
  // 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"));
  }
  
  // Define API routes here
  app.use(routes);
  // Send every other request to the React app
  // Define any API routes before this runs
  
  // ! moved to routes folder
  // app.get("*", (req, res) => {
  //   res.sendFile(path.join(__dirname, "./client/build/index.html"));
  // });
  
  // Connect to the Mongo DB googlebooks database
  mongoose.connect(process.env.MONGODB_URI || "mongodb://localhost/googlebooks");
  
  app.listen(PORT, () => {
    console.log(`🌎 ==> API server now on port ${PORT}!`);
  });
  