Jim's
Tutorials

Spring 2018
course
site

Nate's Work

Explanation of File Structure and how my App is setup in development and production

{
  "name": "client",
  "version": "0.1.0",
  "private": true,
  "proxy": "http://localhost:3001",
  "dependencies": {
    "react": "^16.3.2",
    "react-dom": "^16.3.2",
    "react-router-dom": "^4.2.2",
    "react-scripts": "1.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}
start.rake

namespace :start do
  task :development do
    exec 'foreman start -f Procfile.dev'
  end

procfile.dev

web: cd client && PORT=3000 npm start
api: PORT=3001 && bundle exec rails s
  "devDependencies": {
    "enzyme": "^3.1.0",
    "jasmine-core": "^2.8.0",
    "jasmine-enzyme": "^4.0.1",
    "karma": "^1.7.1",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.1.0",
    "karma-phantomjs-launcher": "^1.0.4",
    "karma-webpack": "^2.0.5",
    "phantomjs-prebuilt": "^2.1.15",
    "react-addons-test-utils": "^15.6.2",
    "react-test-renderer": "^16.0.0",
    "webpack-dev-server": "^2.9.3"
  }
  componentDidMount() {
    fetch(`/api/v1/classrooms`, {
      credentials: 'same-origin',
      method: 'GET',
      headers: { 'Content-Type': 'application/json' }
    })
    .then(response => {
      if (response.ok) {
          return response;
        } else {
          let errorMessage = `${response.status} (${response.statusText})`,
          error = new Error(errorMessage);
          throw(error);
        }
      })
    .then(response => response.json())
    .then(body => {
          this.setState({classroomArray: body.classrooms})
      })
    .catch(error => console.error(`Error in fetch: ${error.message}`));
    }
https://cs.marlboro.college /cours /spring2018 /jims_tutorials /web_tech /project_apr17
last modified Sat December 21 2024 6:38 pm

attachments [paper clip]

  last modified size
TXT Screen_Shot_2018-04-17_at_4.05.30_PM.png Sat Dec 21 2024 06:38 pm 103K