text: const express = require('express');
  const mongoose = require('mongoose');
  const bodyParser = require('body-parser');
  const path = require('path');
  
  const trials = require('./routes/api/trials');
  
  const app = express();
  
  // Bodyparser Middleware
  app.use(bodyParser.json());
  
  // DB Config
  const db = require('./config/keys').mongoURI;
  
  // Connect to Mongo
  mongoose
    .connect(db, {useNewUrlParser: true}) // Adding new mongo url parser
    .then(() => console.log('MongoDB Connected...'))
    .catch(err => console.log(err));
  
  // Use Routes
  app.use('/api/trials',trials);
  
  
  // Serve static assets if in production
  if (process.env.NODE_ENV === 'production') {
      // Set static folder
      app.use(express.static('neuron/build'));
    
      app.get('*', (req, res) => {
        res.sendFile(path.resolve(__dirname, 'neuron', 'build', 'index.html'));
      });
    }
  
    const port = process.env.PORT || 5000;
  
    app.listen(port, () => console.log(`Server started on port ${port}`));