text: 'use strict'
  const express = require('express');
  const app = express();
  const bodyParser = require('body-parser');
  const mongoose = require('mongoose');
  
  const contacts = require('./routes/contacts');
  const companies = require('./routes/companies');
  
  const PORT = process.env.PORT || 3000;
  
  const MONGODB_HOST = process.env.MONGODB_HOST || 'localhost';
  const MONGODB_PORT = process.env.MONGODB_PORT || 27017;
  const MONGODB_USER = process.env.MONGODB_USER || '';
  const MONGODB_PASS = process.env.MONGODB_PASS || '';
  const MONGODB_NAME = process.env.MONGODB_NAME || 'parsec';
  
  const MONGODB_AUTH = MONGODB_USER
    ? `${MONGODB_USER}:${MONGODB_PASS}@`
    : '';
  
  const MONGODB_URL = `mongodb://${MONGODB_AUTH}${MONGODB_HOST}:${MONGODB_PORT}/${MONGODB_NAME}`;
  
  // Mongoose Connect
  // mongoose.connect('mongodb://localhost/parsec');
  
  app.use(express.static(__dirname+'/client'));
  app.use(bodyParser.urlencoded({ extended: false }));
  app.use(bodyParser.json());
  
  app.get('/', function(req, res){
    res.send('Please use /api/companies or /api/contacts');
  });
  
  app.use('/api/contacts', contacts);
  app.use('/api/companies', companies);
  
  mongoose.connect(MONGODB_URL);
  const db = mongoose.connection;
  
  mongoose.connection.on('open', () => {
    app.listen(PORT, () => {
      console.log(`Node.js server started. Listening on port ${PORT}`);
    });
  });
  
  // app.listen(3000);
  // console.log('Started on port 3000...');
  