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);
});
  • 1
    Have a look at this: https://stackoverflow.com/questions/30626410/server-side-rendering-with-react-react-router-and-express?rq=1 – Mμ. Jul 11 '17 at 15:15
  • I will give it a look thank you –  Jul 11 '17 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. –  Jul 11 '17 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. –  Jul 11 '17 at 17:44

0 Answers0