text: const express = require("express");
  const mongoose = require("mongoose");
  require("dotenv").config();
  
  const app = express();
  const PORT = process.env.PORT || 3001;
  
  app.use(express.urlencoded({ extended: true }));
  app.use(express.json());
  app.use("/public", express.static(path.join(__dirname, "client/public")));
  // .env
  if (process.env.NODE_ENV === "production") {
    app.use(express.static("client/build"));
  }
  
  // Define API routes
  app.use("/api", apiRoutes);
  
  // Define API routes and run
  // app.get("*", (req, res) => {
  //   res.sendFile(path.join(__dirname, "./client/build/index.html"));
  // });
  //Connect to MongoDB
  mongoose.connect(process.env.MONGODB_URI || "mongodb://localhost/googlebooks");
  
  app.listen(PORT, () => {
    console.log(`🌎 ==> API server now on port ${PORT}!`);
  });
  