0

To save time I am going to link the github repo and that way I do not have to post all the code and show you how my folder structure is set up etc... When the answer is posted I will post all the code to show how it was done that way people will know how to do it.

github repo: https://github.com/tbaustin/larry_may_2017

I think my main problem is that I may have structured my folders wrong and that is what is making it so hard to do. Everything is working as far as on the client side so my problem is getting it server side rendered and on a hosting site such as heroku. I have looked at the redux and react docs for SSR and I could not make much sense of it and for what I did understand I did not know where to put it.

I will put my server side index.js page on here to have a starting point so this question hopefully doesn't just get kicked off.

const express = require('express');
const http = require('http');
const bodyParser = require('body-parser');
const morgan = require('morgan');
const router = require('./router');
const mongoose = require('mongoose');
const cors = require('cors');
const path = require('path');

//DB setup
mongoose.connect('mongodb://localhost/larry_may_2017')
mongoose.Promise = global.Promise;
//App setup
const app = express();
// app.use(morgan('combined'));
router(app);
app.use(cors());
app.use(bodyParser.json({type: '*/*'}))

//Server setup
const port = process.env.PORT || 3000;
app.listen(port, function() {
  console.log('Server listening on: ', port);
});
4
  • 1
    Have a look at this: stackoverflow.com/questions/30626410/… Commented Jul 11, 2017 at 15:15
  • I will give it a look thank you Commented Jul 11, 2017 at 15:26
  • I feel his app is set up differently and makes my question different tbh. I can't really follow how his is set up. Commented Jul 11, 2017 at 15:54
  • Also found out it is using an old version of react. I more so want someone to help me with my app so I can see where I went wrong or right with my thinking, not just change your app to this persons. Commented Jul 11, 2017 at 17:44

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.