text: const express = require("express");
  const logger = require("morgan");
  const mongoose = require("mongoose");
  const compression = require("compression");
  
  const PORT = process.env.PORT || 8080;
  
  const app = express();
  
  app.use(logger("dev"));
  app.use(compression());
  app.use(express.urlencoded({ extended: true }));
  app.use(express.json());
  app.use(express.static("public"));
  
  // mongoose connection with mongodb variable to connect through heroku
  mongoose.connect(
    process.env.MONGODB_URI || "mongodb://localhost/budget", 
    {
      useNewUrlParser: true,
      useUnifiedTopology: true,
      useCreateIndex: true,
      useFindAndModify: false 
    }
  );
  
  // routes
  app.use(require("./routes/api"));
  
  app.listen(PORT, () => {
    console.log(`App running on port ${PORT}!`);
  });
  