text: import express from 'express';
  import path from 'path';
  import mongoose from 'mongoose';
  import cors from 'cors';
  import postRoutes from './routes/posts.js';
  
  const app = express();
  
  app.use(express.json({ limit: '30mb', extended: true }));
  app.use(express.urlencoded({ limit: '30mb', extended: true }));
  app.use(cors());
  
  app.use('/api/posts', postRoutes);
  
  //Add this constant in a .env
  const CONNECTION_URL =
    process.env.CONNECTION_URL;
  
  //Can change the 3000 if wanting it elsewhere locally, but make sure to change the auth0 /callback and /logout links as well
  const PORT = process.env.PORT || 3000;
  mongoose
    .connect(CONNECTION_URL || 'mongodb://localhost/games_website', {
      useNewUrlParser: true,
      useUnifiedTopology: true,
    })
    .then(() => app.listen(PORT, () => console.log(`Server running on port: ${PORT}`)))
    .catch((error) => console.log(error));
  
  mongoose.connection.on('connected', () => {
    console.log('Mongoose is connected!!!');
  });
  
  app.use(express.static('Client/build'));
  
  const __dirname = path.resolve();
  
  app.get('*', (req, res) => {
    res.sendFile(path.resolve(__dirname, 'Client', 'build', 'index.html'));
  });
  
  mongoose.set('useFindAndModify', false);
  