text: // server.js
  
  // set up ======================================================================
  // get all the tools we need
  var express  = require('express');
  const upload = require('express-fileupload')
  var app      = express();
  require('dotenv').config()
  var port     = process.env.PORT || 8080;
  const MongoClient = require('mongodb').MongoClient
  const ObjectID = require('mongodb').ObjectID
  var mongoose = require('mongoose');
  var passport = require('passport');
  var flash    = require('connect-flash');
  
  var morgan       = require('morgan');
  var cookieParser = require('cookie-parser');
  var bodyParser   = require('body-parser');
  var session      = require('express-session');
  const DB_NAME = process.env.DB_NAME
  const DB_URL =process.env.DB_URL+`/${DB_NAME}`
  
  
  
  // var configDB = require('./config/database.js');
  
  var db
  
  // configuration ===============================================================
  mongoose.connect(DB_URL, (err, database) => {
    if (err) return console.log(err)
    db = database
    require('./app/routes.js')(app, passport, db, ObjectID);
  }); // connect to our database
  
  require('./config/passport')(passport); // pass passport for configuration
  
  // set up our express application
  app.use(morgan('dev')); // log every request to the console
  app.use(cookieParser()); // read cookies (needed for auth)
  app.use(bodyParser.json()); // get information from html forms
  app.use(bodyParser.urlencoded({ extended: true, useUnifiedTopology: true }));
  app.use(express.static('public'))
  app.use(upload())
  
  app.set('view engine', 'ejs'); // set up ejs for templating
  
  // required for passport
  app.use(session({
      secret: 'rcbootcamp2019a', // session secret
      resave: true,
      saveUninitialized: true
  }));
  app.use(passport.initialize());
  app.use(passport.session()); // persistent login sessions
  app.use(flash()); // use connect-flash for flash messages stored in session
  
  
  // launch ======================================================================
  app.listen(port);
  console.log('The magic happens on port ' + port);
  