text: const express = require('express');
  const mongoose = require('mongoose');
  const cookieSession = require('cookie-session');
  const passport = require('passport');
  const bodyParser = require('body-parser');
  mongoose.Promise = global.Promise;
  
  require('./models/User')
  require('./services/authService');
  const authRoutes = require('./routes/authRoutes');
  const billingRoutes = require('./routes/billingRoutes');
  const keys = require('./config/keys');
  
  mongoose.connect(keys.mongoURI);
  
  const app = express();
  
  app.use(bodyParser.json());
  app.use(
    cookieSession({
      maxAge: 12 * 24 * 60 * 60 * 1000,
      keys: [keys.cookieKey]
    })
  );
  app.use(passport.initialize());
  app.use(passport.session());
  
  const PORT = process.env.PORT || 5000;
  
  authRoutes(app);
  billingRoutes(app);
  
  
  if (process.env.NODE_ENV === 'production') {
    // Express will serve up production assets
    // like our main.js file, or main.css file!
    app.use(express.static('client/build'));
  
    // Express will serve up the index.html file
    // if it doesn't recognize the route
    const path = require('path');
    app.get('*', (req, res) => {
      res.sendFile(path.resolve(__dirname, 'client', 'build', 'index.html'));
    });
  }
  
  
  app.listen(PORT, ()=>{
    console.log(`Started server on port ${PORT}`);
  });
  