text: require('dotenv').config();
  
  const express = require('express');
  const cors = require('cors');
  const mongoose = require('mongoose');
  const bodyParser = require('body-parser');
  
  const app = express();
  
  mongoose.connect(process.env.DATABASE_URL, { useNewUrlParser: true });
  const db = mongoose.connection;
  db.on('error', err => console.error(err));
  db.once('open', () => {
    console.log('Connected to Database');
  });
  
  app.use(cors());
  app.use(express.json());
  app.use(bodyParser.urlencoded({ extended: false }));
  app.use(express.static('public'));
  
  app.get('/', (req, res) => {
    res.sendFile(__dirname + '/views/index.html');
  });
  
  const usersRouter = require('./routes/users');
  app.use('/api/users', usersRouter);
  
  const listener = app.listen(process.env.PORT || 3000, () => {
    console.log('Your app is listening on port ' + listener.address().port)
  });
  