require("babel-register");
require("dotenv").config();

const express = require('express');
const path = require('path');
const { connect } = require('./db');
const initPassport = require('./init/passport').default;
const initExpress = require('./init/express').default;
const initRoutes = require('./init/routes').default;

const app = express();

/*
 * Database-specific setup
 * - connect to MongoDB using mongoose
 * - register mongoose Schema
 */
connect();

/*
 * REMOVE if you do not need passport configuration
 */
initPassport();

/*
 * Bootstrap application settings
 */
initExpress(app);

/*
 * REMOVE if you do not need any routes
 *
 * Note: Some of these routes have passport and database model dependencies
 */
initRoutes(app);

/*
 * This is where the magic happens. We take the locals data we have already
 * fetched and seed our stores with data.
 * renderMiddleware matches the URL with react-router and renders the app into
 * HTML
 */
// Serve static files from the React app
app.use(express.static(path.resolve(__dirname, '..', '..', 'client', 'build')));

app.get('*', (req, res) => {
  console.log("!!!!");
  res.sendFile(path.resolve(__dirname, '..', 'client', 'build', 'index.html'));
});

app.listen(app.get('port'));
@@ -1042,22 +1042,16 @@
 e, '..',
- '..',
  'client

fix path